Here are some random things I learned this month!
find files way faster than “find” with mlocate
This one is cool! “Find” can be a pain in the butt sometimes, and it’s really slow if you have a large drive with lots of files on it. Using mlocate, you can find files nearly instantly by name and not have to fool with special flags.
It’s super easy to use too:
- Install mlocate: sudo apt install mlocate
- Generate a file database: updatedb
- Locate a file by typing locate filename
Boom! Instant result.
Remember commands and flags easier with fish shell
Find yourself constantly reading the man page or googling new commands or commands that you haven’t used in a while? I do!
Fish shell (Friendly Interactive Shell) has awesome autosuggestion and autocompletion features that make remembering commands and flags a breeze. Mile-long commands pop up after typing the first few letters, and pressing tab will display a complete list of flags and their functions. See the difference here:
Bash: (I typed ls – and pressed tab)
Fish: (I typed ls- and pressed tab)
Which one is easier??
The autocompletes are super handy too–here is a recently used command that it suggests when I just type the letter T:
This is one most people probably already know, but I’m just learning how powerful rsync really is. In short, rsync:
- Can resume interrupted transfers easily
- Saves tons of time by doing incremental, rather than full backups
- Can keep folders synced between a remote server and a local machine when combined with a systemd timer
- Compresses and decompresses on the fly, also saving time and bandwidth
- When combined with ssh, it’s encrypted
The command with the flags I use most commonly is rsync -chavzP –stats /source/ /destination/
This combination of flags checks to see if files have changed, adds a progress bar, checks the folder recursively, enables compression, enables resuming an interrupted transfer, and gives verbose + human readable output.
Here’s an example:
Note the 82% speedup we get from the compression and decompression!
You can combine rsync with ssh like this:
rsync -chavzP –stats firstname.lastname@example.org:/source/folder /destination/on/local/machine
Here’s what a backup of this website from my VPS to my laptop looks like:
Last but not least– Explainshell.com
I found out about this handy website from a reddit comment. You can paste or type any command with any number of flags and it will explain what it does in a tree format:
That’s it for now. I’ll update when I learn more fun stuff!
Leave a Reply