Most of the “commands” I use are external binaries - i.e. not necessarily “Linux”.
Probably rsync
*, and (p)rename
… and maybe ffmpeg
… and systemctl
… and of course apt
… I do maybe 75% or more of stuff in the shell (zsh in my case) - don’t often use the filemanager, and more often that not - if I’m running the filemanager (e.g. files in Ubuntu / Pop!) I’ll right click and “Open in terminal” to continue doing stuff…
There are a few differences in the “families” - e.g. Debian VS Red Hat…
Debian busybox doesn’t have vi (you can only use nano)
Red Hat busybox does have vi
Busybox version of “cat” doesn’t display line numbers -i.e. “cat -n filename
” won’t run 'cause there’s no “-n
” option in that version of cat… That’s super annoying in e.g. busybox in MobaXterm (i.e. cygwin busybox) - I sometimes need to see what line number in my ssh config files might be the issue (e.g. in MobaXterm ~/.ssh/config
and ~/.ssh/known_hosts
.
And I’ve mentioned before “rename” command (package) in DEB based distros is different to the one in Red Hat derived distros. (p)rename in DEB is the perl rename utility from CPAN, and supports sed style regex, Red Hat (e.g. Fedora, Oracle, RHEL, CentOS) rename is a completely different beast to perl rename - but you can install perl rename on them (don’t remember how exactly - i.e. which RPM package hosts it) - one time I needed it was able to install it from the CPAN perl repository (so long ago now I don’t remember the exact syntax).
I don’t currently have any Red Hat distros I can access quickly to verify how I installed (p)rename. I haven’t powered up my Gigabyte Brix mini-PC with RHEL8 for a couple months now. I’m on Xmas break leave - so not going to connect to any customer systems to verify… I do have a few RPM based VM’s in QEMU / UTM on Mac and virtualBox on Linux, but I don’t think I’ve ever installed (p)rename on them…
* rsync
: I often think like I’m using “cp” and forget “-av” switches… I just now made an alias :
alias rink='rsync -av'
I tend to use rsync a lot more than cp, but one thing I prefer about “cp” is you can change the name of the destination, if the source is a directory - what rsync does is create a new folder if that doesn’t exist, and copy the source folder as a folder, into that new dir. I prefer cp behaviour when it comes to that…
e.g.
cp -r ~/Downloads/MusicFolder ~/Music/NewMusicFolder
will copy the dir “MusicFolder
” to ~/Music/.
but name it “NewMusicfolder
”
rsync -av ~/Downloads/MusicFolder ~/Music/NewMusicFolder
will copy “MusicFolder
” to ~/Music/NewMusicFolder/MusicFolder
(i.e. it will create directory ~/Music/NewMusicFolder if it doesn’t exist).
I also use “find” all the time too - but I kinda hate how clunky it is… obtuse… kinda stupid… like if you use the “-exec” switch - you have to append a “\;” to the end of the find command to make it exec on each file it finds… And half the time switches like “-xdev” or “-mount” don’t do what they’re supposed to - e.g. I want to find files larger than 128 MB on the whole dir structure of “/” - BUT - not NFS or SMB mounts, and NOT other mountpoints :
find / -xdev -size +128M
in many cases it will work (e.g. it won’t traverse /var if it’s a separate mount) - but in other cases even though you explicitly told it to stick to “/” - will will interrogate other mount points! And worst of all - it will interrogate /proc (and barf on every attempt to traverse the /proc subfolders). So - if you want to exclude specific folders - you have to use MULTIPLE “prune” commands - that’s bullshit and makes it very unwieldy (especially at 3 am when you’ve just been paged for a disk space alert). So - I try to avoid using “find” in that use case - invariably anway - it’s probably going to be something in /var - so I use “du” instead - e.g. “du -sh /var/ |sort -h
”, or “du -d 1 /var/ | sort -h
”