Bash shell command line commands and tools
*nix
code
Here you will find an assortment of code snippets for a variety of terminal utilities and applications.
apt package manager
Apt is a software package manager.
- Listing installed apps
- Installing a new package
- Searching for packages (packages may have different prefixes or unique naming conventions between linux distributions)
Optionally, if there are too many results, you may pass the search results, using the |
operator to more
or less
grep
One applied use case of the powerful grep
utility is recursively searching files for a given parameter or value.
The -r
flag enables recursive searching in the location .
(current directory).
pv
If you are copying a large file using cp
, you will not have a progress indicator. pv
performs the same function while echoing the output1.
rsync
Basic recursive file copying between a source
and destination
using the rsync
utility.
The option flags -avzh
represent -a
recursive archival copying, -v
verbose output, -z
compression and -h
human readable STDOUT
.
sshfs
Sshfs allows the local mounting of remote file systems. Mounts can be manual (session-based) or permanent (via fstab
system entries)
- Manual (session-based) - keyless (password) authentication
- Manual (session-based) - key-based (paswordless) authentication
- Unmounting the share
Note: sudo
may be required depending on your chosen local
mounting point. However, this will then require you to have sudo
read/write privileges for full access to the share
tar/gzip
Folder archival and compression in linux is achieved using a combination of two common tools2.
- Archive and compress
- Decompress and expand
tmux
This tool is a terminal multiplexer allowing a user to run multiple parallel command line terminal prompts while allowing them to run in the background. Benefits include running time-consuming tasks on remote servers while being able to exit the ssh
session.
- Create a new session
- Detach from a running session
CTRL + b
followed byd
- Attach to an existing session
- List existing sessions
- Remove session
For documentation material on the Bash cli, read the introduction to Bash page.