Package managers
Lists package managers for common distributions.
2 minute read
Lists package managers for common distributions.
A quick cheat sheet for the vi editor
Here are a few reminders for quick reference.
% ls // list files - compact, horizontal
% ls -l // list files - detail list
% ls -la // list all files, incl hidden, symlinks
% ls -la -t // sort list by last file update, descending
% ls -la -t | pbcopy // sort list & copy to Clipboard
% ls -l . | wc -l // Count files in a folder (wc lowercase L)
% cat <filename> | wc -l // Count lines in a file (wc lowercase L)
% cp <source> <target> // Copy file
% cp -R <source>/ <target>/ // Copy files, recursively
% mv <source> <target> // Move file (rename)
% rm <filename> // Remove file (delete)
% rmdir <folder> // Remove empty directory
% rm -rf // Remove non-empty directory & children (Careful!)
% df // Disk free (available storage space)
% du -ah d // Disk used - show all files
% du -hc // Disk used - Folder summary
// Create a tarball (create, view files as added, compress, next value is tarball filename)
% tar -cvzf <tar_filename> <filespec>
// Take ownership of a file
% chown -R (whoami) <filename>
Current date:
% date
Current date as Epoch (milliseconds since 1970):
% date +'%s'
Convert Epoch time to local time:
% date -R <input value>
If your result seems highly inaccurate, your input value is likely expressed in milliseconds.
When this happens, try removing last three characters:
$ date -r 1722865314420 // Wed Jun 5 11:27:00 PDT 56565 (wrong)
$ date -r 1722865314 // Mon Aug 5 06:41:54 PDT 2024 (right)
Current month:
% cal
What shell am I using?
% echo $0
Which file is the shell resource file?
~/.bashrc
(~/.profile
on earlier Macs)~/.zshrc
Script debug info?
-xv <scriptname> <options>
Set up DNS for a home network (Steve’s Smarthome Guide)
DNS and DNSMasq [Steve’s Smarthome Guide]
.gitignore
, .DS_Store
, and so on), which means it’s useful for maintenance scripts and cleanup.