Skip to main content

Command Quick-Ref

CommandFunction
echo $PATH | tr ':' '\n'Zeigt $PATH in human readable format
ln -s source_file link_nameCreate Symlink
tail -n 5 file.txtDisplays the last 5 lines of the file “file.txt”
head -n 5 file.txtDisplays the first 5 lines of the file "file.txt"
rsync -av source destinationSync folders
chmod +x myScript.shMake file executable
tar -czvf archive.tar.gz files/Creates a compressed archive containing the files in “files/”.
which executable-on-pathShows path to executable
netstat -tulnapList of tcp/udp connections with PID
ssh user@hostnameInitiates an SSH connection to the specified hostname
scp file.txt user@hostname:/path/to/destinationSecurely copies “file.txt” to the specified remote host
wget http://example.com/file.txtDownloads “file.txt” from the specified URL
nmtuiNetwork configuration tool
telnet [address] [port]Testing a port
your_command &> logfile.logstdout and stderr to logfile.log
your_command &>> logfile.logappend to logfile.log
your_command > output.log 2>/dev/nullstdout to output.log, stderr to nirvana
your_command 2>&1 | tee logfile.loglog in file and show on screen
export VARIABLE_NAME=valueSets the value of an environment variable.
unset VARIABLE_NAMEUnset variable
PATH=$PATH:/path/to/dir
export PATH
Adding dir to $PATH
ip addr show
ip route
IP address, routing information
sudo tar -xvzf my_program.tar.gz -C /usr/local/bin/Create a directory /usr/bin/my_program/ and extract the contents of the archive into /my_program/
tar -tf your_archive.tar.gzList contents of an archive without extracting
getent passwd $USER | cut -d: -f7
echo $SHELL
Show current default Shell
cat /etc/shellsShow available Shells
chshChange default Shell
sudo apt update && sudo apt upgrade -yUpdate repositories and upgrade packages