____ _ _ _ _ _ _ _ _ _ _ ___
/ ___| _ __ ___ __ _| | | | | | | |_(_) (_) |_(_) ___ ___ |_ _|
\___ \| '_ ` _ \ / _` | | | | | | | __| | | | __| |/ _ \/ __| | |
___) | | | | | | (_| | | | | |_| | |_| | | | |_| | __/\__ \ | |
|____/|_| |_| |_|\__,_|_|_| \___/ \__|_|_|_|\__|_|\___||___/ |___|
_ _ _
| | (_) | _____
| | | | |/ / _ \
| |___| | < __/
|_____|_|_|\_\___|
stat
Show file info.
File: little_programs.md
Size: 5277 Blocks: 16 IO Block: 4096 regular file
Device: 805h/2053d Inode: 6554954 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ ghost) Gid: ( 1000/ ghost)
Access: 2022-02-21 20:48:37.840867061 +0100
Modify: 2022-02-21 20:41:44.774001797 +0100
Change: 2022-02-21 20:41:44.778001768 +0100
Birth: 2022-02-21 20:41:44.774001797 +0100
file
Show what type of file something is.
amfora_temp: directory
dbus-U00gxuKxNT: socket
scoped_dirNCvmsA: directory
serverauth.ELLhbMvz60: X11 Xauthority data
watch
Watch a command for changes in the output.
Or watch how much of the filesystem is free.
Timeout
Let a command run for a limited amount of time:
Useful if you want a process to automatically run, but itโs in danger of stopped, and asking you some questions. For example, if you want to โapt updateโ, then that might work, but it might stall until you answer a question. You canโt really answer that question if the thing is running as part of a script, so to avoid having it hang, just cancel it after 10 minutes (or some time longer than an upgrade might take).
NB: When using sudo, the timeout command will apply to sudo itself, so best to run after the sudo, e.g.
sudo timeout 10m apt upgrade -y
This may still lock the database, but at least you wonโt have a bunch of useless scripts building up.
cloc
Count the lines of code in a repository.
59 text files.
48 unique files.
18 files ignored.
github.com/AlDanial/cloc v 1.92 T=0.05 s (879.2 files/s, 181191.9 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C++ 7 934 255 4916
C/C++ Header 8 103 106 724
TeX 7 113 16 660
CSV 8 0 0 654
Python 4 59 49 652
Markdown 3 187 0 220
Bourne Shell 4 34 14 121
make 5 0 0 49
YAML 1 0 0 15
CMake 1 3 5 3
-------------------------------------------------------------------------------
SUM: 48 1433 445 8014
-------------------------------------------------------------------------------
This can be useful for an overview of a project. The program is also great at counting actual lines of code, rather than just lines. The following contains 6 lines:
ls -t | \
sort -r > list
cat < list
cloc will recognize blank lines are not lines of code, and recognize joined lines of code as separate.
duf
This outputs disk usage with a nice display.
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ 2 local devices โ
โโโโโโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโโฌโโโโโโโโโโโโโค
โ MOUNTED ON โ SIZE โ USED โ AVAIL โ USE% โ TYPE โ FILESYSTEM โ
โโโโโโโโโโโโโโผโโโโโโโโโผโโโโโโโโโผโโโโโโโโโผโโโโโโโโโผโโโโโโโผโโโโโโโโโโโโโค
โ / โ 117.6G โ 63.7G โ 47.8G โ 54.2% โ ext4 โ /dev/sda5 โ
โ /boot/efi โ 602.1M โ 152.0K โ 602.0M โ 0.0% โ vfat โ /dev/sda6 โ
โฐโโโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโดโโโโโโโโโโโโโฏ
notify-send
Output a message to your desktop.
sleep 8m && notify-send Tea 'water boiling' & disown
This will output a notification to finish making tea in 8 minutes. The โdisownโ statement tells the terminal to leave the process running, even without the terminal.
fzy
This gives you the ability to type through a list to select an item.
Try this for a start:
ghost ~
โโโบโ๏ญ ls | fzy
>
Distros
LK
Mail
Projects
VMs
arc
dl
gollum
img
kn
Okay - not terribly impressive so far. But we can do things with the output.
cd $(find ~/\* -type d | fzy)
Now we can find anywhere in the home directory and change directory there instantly. Or open any nearby file in vim:
alias vf='vim "$(find -type f | fzy)"'
Now you can just type in vf and type the name of a file you want to edit, and fzy will find it for you.
onefetch
Output a summary of a Git.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Malin Freeborn ~ git version 2.35.1
$$$ $$$$$$$ $$$$$ $$ -----------------------------------
$$ $$$$ $$$$ $$$$$$$$$ $$$$$$$ $$$$$ Project: core (3 branches, 6 tags)
$$ $$$$$ $$$$$ $$$$$$$$$$ $$$$$ $$$$$$ HEAD: 115ba07 (dev, origin/dev)
$$ $$$$$ $$$ $$$$ $$$ $$$$$$$ Pending: 20+-
$$ $$$$$ $$$$$ $$$$$ $$$$ $ $$$$$$$$ Version: 0.6
$$$$$$$$ $$$$$ $$$$$$ $$$$$ $$$$$$$$$ Created: 2 years ago
$$$$$$$$ $$$$$ $$$$$$ $$$$$ $$$$$$$$$ Language: TeX (100.0 %)
$$$$$$$$ $$$$$ $$$$$$$$$$$$ $$$$$$$$ Authors: 100% Malin Freeborn 2188
$$$$$$$$ $$$$$ $$$ $$$$$$$ $$ $$$$$$$ 0% Vladar4 1
$$$$$$$$ $$$$$ $$$$$$ $$$$ $$$$$$ Last change: a week ago
$$$$$$$$ $$$$$ $$$ $$$$$ $$$$$$ $$$$$ Repo: https://gitlab.com/bindrpg/core
$$$$$$$$ $$$$$ $$$$$$$$ $$$$$$$$ $$$$ Commits: 2189
$$$$$ $$ $$$$$ $$$$$$ $$ Lines of code: 8416
$$$$$$$$$$$$$$$ $$$$$$$ $$$$$$$$$$$$$$$ Size: 11.22 MiB (78 files)
$$$$$$$$$$$$$$$ $$$$$$ $$$$$$$$$$$$$$$$ License: GPL-3.0-only
$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$