Link Search Menu Expand Document

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
sudo apt list --installed
  • Installing a new package
sudo apt update
sudo apt install PACKAGENAME
  • Searching for packages (packages may have different prefixes or unique naming conventions between linux distributions)
sudo apt search SEARCHTERM

Optionally, if there are too many results, you may pass the search results, using the | operator to more or less

sudo apt search SEARCHTERM | more
sudo apt search SEARCHTERM | less

grep

One applied use case of the powerful grep utility is recursively searching files for a given parameter or value.

grep -r "parameter=1000" .

The -r flag enables recursive searching in the location . (current directory).

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)
sshfs -o allow_other,default_permissions [email protected]:/remote/mount/ /local/mount/
  • Unmounting the share
umount /local/mount

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

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
tmux new-session -s SessionName
  • Detach from a running session CTRL + b followed by d
  • Attach to an existing session
tmux attach-session -t SessionName
  • List existing sessions
tmux ls
  • Remove session
tmux kill-session -t SessionName

For documentation material on the Bash cli, read the introduction to Bash page.