Check out my new books that I just published...
Linux includes a large number of commands for doing system administration tasks from the command line. This article contains a short list commands that every Linux user should know.
This is not an exhaustive list, but it is a good place to get started using the command from the console.
1: User Executable Programs or Shell Commands
2: System Calls (Functions provided by the Kernel)
3: Library Calls (Functions within program libraries)
4: Devices and Special Files (generally found in /dev)
5: File Formats and Conventions (i.e. /etc/passwd)
6: Games
7: Miscellaneous (includes macro packages and conventions), e.g. man(7), groff(7)
8: System Administration tools and Daemons (requires root)
9: Kernel routines [Non standard]
Tricks:
$ man -s 1 printf
$ man -k '^printf'
Creating One-Liners Command (i.e. stringing together commands)
';' runs one command right after another.
Ex: commandName1; commandName2
'&' runs one command right after another.
Ex: commandName1 & commandName2
'&&' Will only run the second command if the first one doesn't fail.
Ex: commandName1 && commandName2
You can use the following options to recall the last command or arguments from the last command.
Reuse the previous command, type: !!
The 'n' represents the position of the argument you want to recall, type: !!:n
Reuse the last argument from the previous command, type: !$ --OR-- $_
Reuse the first argument from the previous command, type: !^
Reuse all the arguments from the previous command, type: !&
Reuse a specific argument in the last command, enter its position (i.e. 1 = 'a.txt', 2 = 'b.txt', etc.), type: !:1
The most recent command matching pattern, type: !pattern
Last command, substitute 'find' with 'replace', type: !!:s/find/replace
Used to monitor user activities (i.e. process accounting)
Ex: sudo accton [on|off]
Displays the battery status and other ACPI information
Note: Information from the /proc or the /sys.
Ex: acpi [<options>]
Manages physical or virtual terminals multi-user access
Ex: sudo agetty <options>
Creates an alias (or short name) for a command or sequence of commands.
Notes:
To see all the aliases, type: alias
To delete an alias with unalias <aliasName> command.
Ex [type: ll instead of ls -l]: alias ls -l=ll
Allows you to search help system on any commands installed on the local system.
Ex: apropos <commandName>
A package management utility, for installing software on Debian Linux Distros
Note: apt was first available in Ubuntu 16.04 to simplify the package management and to merge multiple commands (i.e. apt-get, etc.) into one single command.
Tip: sudo apt update && sudo apt upgrade (Updates the local system)
Ex: sudo apt install packageName
A package management utility, for installing software on Debian Linux Distros
Tip: sudo apt-get update && sudo apt upgrade (Updates the local system)
Ex: sudo apt-get install packageName
Displays the computer CPU architecture.
Ex: arch
Manages (i.e. creates, modifies, or extracts) archive files.
Ex: ar r fileName.a *.ext
Shows the current process that was moved to the background (user must be logged in).
Notes:
Appending an ampersand ( & ) to end of a command runs the job in the background.
Pressing Ctrl+Z suspends the current foreground process.
Ex: bg
Bind a key sequence to a Readline function or a macro, or set a Readline variable.
Ex: bind -l
Executes shell builtins with arguments without performing command lookup.
Ex: builtin -b
Removes sections of text from each line of file.
Ex: echo 'Hello, World' | cut -b 1,3
Displays local system information using the /proc directory.
Ex: cat /proc/meminfo
Ex: cat /proc/cpuinfo
Manipulates the real-time attributes of a process.
Ex: chrt -p <processID>
Switch between the different TTY (TeleTYpewriter) terminals
Ex: chvt
Changes a processes root directory.
Note: Every process/command in Linux has a current working directory called 'root' directory.
Ex: sudo chroot /directoryName/path command
Displays the kernel ring buffer.
Ex: dmesg
Displays environment variables.
Ex: env | less
Exits the shell or console window.
Ex: exit
Edits and re-execute the commands previously entered into the interactive shell
Ex: fc
Sends a job to the foreground (user must be logged in).
Ex: fg %1
Displays the total amount of free memory used and swap space on the local system.
Ex: free -h
Display entries important text files called databases (i.e. passwd, group, etc.)
Troubleshooting: Useful tool checking several configuration files.
Ex: getent passwd ubuntu
Displays a hash table of recently executed programs.
Ex: hash
Instructs the hardware to stop all the CPU functions.
Ex: halt
Displays help for internal commands [i.e. ls, exit, etc.]
Ex: help <commandName>
Displays a list of the most recently used commands.
Note: To re-execute a command (i.e. 199) from the list, type: !199
Ex: history.
Tip: history | grep "searchString" (Searches the contents of STDOUT)
Displays a list of running processes on local system
Install: sudo apt install htop
Ex: htop
Manages the hardware clock (aka Real Time Clock [RTC])
Ex: sudo hwclock
Displays help on any command installed on the local system.
Note: similar to the man command.
Ex: info <commandName>
Installs program binaries.
Ex: install sourceFile.ext destFile.ext
Monitors local system input/output statistics for devices and partitions
Install: sudo apt install sysstat
Ex: iostat
Removes IPC resources and associated data structure from the local system
Note: IPC is Inter-Process Communication
Ex: ipcrm
Displays information on the IPC facilities for the calling processes
Note: IPC is Inter-Process Communication
Ex: ipcs
Queries the 'systemd' journal.
Ex: journalctl
Displays the status of all current job (i.e. running process or group of processes).
Ex: jobs
Kills a running process by PID (Process ID).
Ex: kill -9 <processID>
Kills a running processes by name.
Ex: killall -9 <processName>
Logs the user off the local or remote system.
Ex: logout
Displays file attributes on a second extended file system.
Ex: lsattr -a
Displays a list of block device.
Ex: lsblk
Displays information about the CPU.
Ex: lscpu
Displays information about the file locks.
Ex: lslocks
Displays information about the PCI.
Ex: lspci
Displays information about the users accounts on the local system.
Ex: lslogins
Displays information on the IPC facilities for the calling processes
Note: IPC is Inter-Process Communication
Ex: lsipc
Displays information about the memory on the local system.
Ex: lsmem
Displays detailed information of the local system’s hardware configuration (/proc directory)
Ex: lshw
Displays the status of Linux kernel modules.
Ex: sudo lsmod
Tip: ls -l /lib/modules/$(uname -r)/kernel (directory of installed modules)
Displays a list of open files.
Ex: lsof
Displays information about USB bus and the connected devices
Ex: lsusb
Displays information about the OS.
Ex: lsb_release -a
Displays help on any command installed on the local system.
Ex: man <commandName>
Ex: <commandName> --help
Displays information about a Linux Kernel module
Ex: sudo modinfo -V
Tip: ls -l /lib/modules/$(uname -r)/kernel (directory of installed modules)
Runs a command in the background, even when the user is not logged in.
Ex: nohup pi 200000 (calculates pi to 20,000 place in the background)
Reboots the local system.
Ex: reboot
Displays a memory map of a process identifier.
Ex: pmap <processID>
Shuts down the local system.
Ex: poweroff
Displays environment variables.
Ex: printenv | less
Displays a list of running processes.
Ex: ps -aux
Shuts down the local system.
Ex: shutdown now
Sorts text in a file or stream.
Ex: cat filename.ext | sort
Manages (changes communication settings) the console line settings
Ex: stty
Executes commands as a root administrator privileges temporarily.
Ex: sudo programName
Manages (i.e. start, stop, and restart) the state of the 'systemd' system and service manager.
Ex: systemctl
Displays how long it takes a command to execute.
Ex: time echo "Hello, World"
Displays a list of running processes on the local system
Ex: top
Reference: Process States
D: Uninterruptible sleep, R: Running, S: Sleeping, T: Traced (stopped), Z: Zombie
Displays the terminal connection you are connected on.
Ex: tty [<options>]
Displays information about command type.
Ex: type <commandName>
Executes a program periodically, showing a fullscreen output.
Ex: watch <commandName>
A system performance monitoring command, displays hardware information
Ex: vmstat
Displays information about the OS.
Ex: uname -a
Removes duplicate text in a file or stream.
Ex: cat filename.ext | uniq
Displays how long the local system has been up (i.e. running)
Ex: uptime
Displays a brief description of a console utility.
Ex: whatis <commandName>
Displays the path of executable file.
Ex: whereis <commandName>
Pattern scanning and processing language.
Ex: tail -f access_log | awk '/myhome.html/ { system("nmap " $1 ">> logdir/myhome.html") }' (Runs an external command for particular lines of data)
Removes directory and suffix from filenames
Ex: basename /usr/bin/sort
BZ compression utilities.
Ex: bzcmp, bzdiff, bzgrep, bzip2, bzless, bzmore
Displays the contents of a text file.
Ex: cat fileName.ext
Ex: cat fileName.ext | less (Displays a text file one screen full at a time.)
Changes the path from the current directory, to a different one.
Ex: cd directoryName
Manages (i.e. add, delete, or change) disk partition table [uses TUI]
Ex: sudo cfdisk
Changes attributes on a file in a directory.
Ex: chattr +i fileName.ext
Changes permissions on a file.
Ex: chmod +rwx +ugw fileName.ext
Reference: Permission Codes
r: read, w: write, x: execute
u: user, g: group, w: world
0: None, 1: Execute, 2: Write, 3: Write & Execute, 4: Read, 5: Read & Execute, 6: Read & Write, 7: Read, Write & Execute
Displays a CRC(Cyclic Redundancy Check) value, the byte size of the file in STDOUT
Ex: cksum nameFile.ext
Changes the owner:group of a file
Ex: chown userName:groupName fileName.ext
Compares two files byte by byte.
Ex: cmp fileName1.ext fileName2.ext
Makes a copy of a file(s).
Ex: cp fileName1.ext fileName2.ext
Creates an empty disk image.
Ex: dd if=/dev/zero of=imageName bs=1024 count=10240
Displays disk usages for directories.
Ex: du -h
Starts VIM editor in 'extended' mode (e.g. line editor mode).
Note: To displays the first line of file type '1p'
Ex: ex fileName.ext
Displays the size, space used, and space available on the mounted filesystems
Note: Filesystems listed in /etc/fstab are mounted during the booting process.
Ex: df -h
Compares two files, and shows the differences.
Ex: diff fileName1.ext fileName2.ext
Converts file or STDIN tabs to spaces
Ex: expand fileName.ext
Formats a disk using a text based UI for managing disk partition tables
Ex: sudo fdisk -l
Finds files or directories in the local filesystem that matches designated criteria.
Ex: find ./ -type f -name fileName.ext
Ex: find ./ -type d -name directoryName
Determine the MIME file type (i.e. ‘text/plain; charset=us-ascii’)
Ex: file fileName.ext
A simple text formatter that reads STDIN or a file sends to STDOUT.
Ex: fmt -w 15 fileName.ext
Wraps each line of an input file to fit a specified width and displays to STDOUT.
Ex: fold fileName.ext
Searches the contents of a file.
Ex: grep "searchString" fileName.ext
Creates auto-decompressing executables
Ex: gzexe directoryName/
Utility that compresses multiple files into a single file.
Ex: gzip fileName.ext
Used to get statistics about the hard disk, alter writing intervals, acoustic management, and DMA settings
Ex: sudo hdparm -I /dev/sda
Displays the top lines of a text file.
Ex: head fileName.ext
Tip: head /proc/meminfo
Displays a file or STDIN in ASCII, decimal, hexadecimal, octal format to STDOUT
Ex: hexdump fileName.ext
Tip: echo "Hello, World!" > helloworld && hexdump helloworld
Converts text from one encoding into another encoding.
Ex: iconv -f UTF-8 -t ASCII//TRANSLIT -o outputFileName.txt inputFileName.txt
Displays one screen of STDOUT at a time.
Note: The less command is better then more command.
Ex: less fileName.ext
Tip: cat /proc/meminfo | less
Searches for files or directories in the local filesystem that match designated criteria.
Ex: locate fileName.ext
Creates symbolic links to a specific file.
Ex: ln fileName.ext link2File.ext
Ex: ln -s fileName.ext link2File.ext
Displays a list of files.
Ex: ls -l
Tip: ls -al ~ (Lists all the hidden files in the home directory)
Verify file integrity using MD5 (Message Digest Algorithm 5)
Ex: md5sum nameFile.ext
Tip: md5sum /proc/meminfo
Creates a new directory.
Ex: mkdir directoryName
Displays one screen full of text to STDOUT at a time.
Ex: more fileName.ext
Ex: cat nameFile.ext | more
Attaches a separate filesystem (such as an flash USB drive or external hard drive ) to the main filesystem on the local system.
Note: Filesystems listed in /etc/fstab are mounted during the booting process.
Ex: mount -t iso9660 -o ro /dev/cdrom /mnt
Moves or renames a file.
Ex: mv fileName1.ext fileName2.ext
ncdu (NCurses Disk Usage) provides a navigable overview of file space usage.
Install: sudo apt install ncdu
Ex: ncdu
Displays line numbers of files.
Ex: nl fileName.ext
Tip: nl /proc/meminfo
Dumps a file in octal (and other) formats
Ex: od fileName.ext
Tip: od /proc/meminfo
Combines two files by merging data, separated by a delimiter to STDOUT.
Ex: paste -d "|," number fileName1.ext fileName2.ext
Changes current directory to the last one stored in the stack.
Note: This stack is LIFO (Last In First Out) based, (i.e. like a stack of paper, where you take the sheet off the top).
Related: pushd
Ex: popd
Pushes the current directory into the stack.
Note: This allows you to return to the directory at a later time.
Related: popd
Ex: pushd
Displays the current directory path.
Ex: pwd
Displays resolved symbolic links or canonical file names
Ex: touch fileName1.ext; ln -s fileName1.ext fileName2.ext; readlink fileName2.ext
Changes the name of one file or set of files.
Ex: rename fileName1.ext fileName2.ext
Tip: rename -n 's/jpeg/png/' *.jpeg (Renames files according to a regular expression.)
Reverse the characters in STDIN or a file
Ex: rev fileName.ext
Tip: rev /proc/meminfo
Deletes a file (or multiple files when using a wildcard).
Ex: rm fileName.ext
Tip: rm -rf directoryName (Deletes a directory, including all files and subdirectories)
Deletes the current directory, unless you specify one.
Note: The target directory must be completely empty.
Ex: rmdir directoryName
Removes a Linux kernel module.
Ex: sudo rmmod moduleName
Tip: ls -l /lib/modules/$(uname -r)/kernel (directory of installed modules)
Monitors local system resources utilization, such as: CPU, Memory, I/O devices, etc.
Ex: sar -u 2 5
Compares two files and then displays the results to STDOUT in a side-by-side format
Ex: sdiff fileName1.ext fileName2.ext
Manipulate lines of a file or stream by replacing specified parts.
Ex: sed 's/keyword1/keyword2/g' fileName.ext
Displays the last time file was accessed, modified, and changed.
Ex: stat fileName.ext
Tip: stat /proc/meminfo
Utility for joining lines in two files.
Ex: join fileName1.txt fileName2.txt
Displays the checksum and block count of a file
Ex: sum fileName.ext
Tip: sum /proc/meminfo
Displays files in reverse (i.e. bottom line first, first line last).
Ex: tac fileName.ext
Tip: tac /proc/meminfo
Displays the bottom lines of a text file.
Ex: tail fileName.ext
Tip: tail /proc/meminfo
Combines and compresses files in to an archive (aka TAR)
Ex: tar -cvzf fileName.tar.gz directoryName/
Decompresses and extracts files from an archive (aka TAR)
Ex: tar -xvzf fileName.tar.gz directoryName/
Reads from STDIN and write to STDOUT and files
Ex: wc -l fileName1.txt| tee fileName2.txt
Creates an empty file.
Ex: touch fileName.ext
Converts characters for strings (i.e. from lower to uppercase).
Ex: tr "[:lower:]" "[:upper:]" < fileName.ext
Tip: tr "[:lower:]" "[:upper:]" < /proc/meminfo
A recursive directory listing of depth-indented listing of files
Ex: tree /directoryName/path
Tip: tree /proc/
Removes a separate filesystem from the main filesystem on the local system.
Ex: umount -f /mnt
Converts file or STDIN spaces to tabs
Ex: unexpand fileName.ext
The default text editor that comes with the OS (aka VIsual editor).
Tip: vim fileName.ext
Ex: vi fileName.ext (generally a shortcut to vim)
Displays line, word, byte count.
Ex: cat fileName | wc -l
Searches for executables files in the $PATH system environment variable.
Ex: which <commandName>
Tip: which touch
Executes commands from STDIN.
Ex: find /directoryName -type f -name "*.ext" | xargs grep -i 'searchText'
Displays a hexdump (or the reverse).
Ex: xxd fileName
Tip: echo "Hello, World!" > helloworld && xxd helloworld
Runs commands with arguments suppressing shell function lookup.
Ex: command -v grep
Ex: command -V grep
Displays possible completions depending on the options.
Ex: compgen -v
Specify how arguments are to be completed by Readline.
Ex: complete -p
Sets variable values and attributes.
Ex: declare -p
Display the list of currently remembered directories.
Note: Works with popd and pushd
Ex: dirs -v
Removes a job from the table of active jobs.
Note: Works with bg command.
Ex: disown <jobID>
Enables and disables builtin shell commands.
Ex: enable -a
Executes arguments as a shell command.
Note: This is useful when you build dynamic commands via scripts
Ex: cmd="echo"; txt1="Hello, "; txt2="World!"; eval $cmd $txt1 $txt2
Replace the shell with the given command.
Ex: exec > fileName.ext (redirection the output to a files)
Creates an environmental variable
Ex: export country=USA
Mark a variable or function as read-only, so that it can not be changed
Ex: readonly [-af] [name[=value] ...]
Creates a function, multiple command working together to complete a specific task.
Syntax: functionName() { commandName ; commandName }
Ex:
Shift the positional parameters left by N number of times and renames
Ex: shift [n]
getopts optstring name [arg]
jobs [-lnprs] [jobspec ...] or job
let arg [arg ...]
local name[=value] ...
select NAME [in WORDS ... ;] do CO
set [--abefhkmnptuvxBCHP] [-o opti
shopt [-pqsu] [-o long-option] opt
suspend [-f]
test [expr]
times
trap [-lp] [arg signal_spec ...]
typeset [-afFirtx] [-p] name[=valu
ulimit [-SHacdfilmnpqstuvx] [limit
umask [-p] [-S] [mode]
Manages the local system's ARP cache.
Ex: arp -a
Displays the output from HTTP/HTTPS request.
Ex: curl https://www.example.com
Displays DNS information for a domain name.
Ex: dig domainName
Displays remote IP address of a domain name.
Ex: host domainName
Displays the host ID in hexadecimal format.
Note: A unique number that is is based on the local system's IP address, in hexadecimal format.
Ex: hostid
Displays the IP address of a local host system.
Ex: hostname -i
Manages Linux system hostname and related settings.
Ex: hostnamectl
Displays IP address, network interfaces, etc. of the local system.
Ex: ip a
Maintain iptables for the Netfilter firewall for IPv4, included in the Linux kernel
Ex: sudo iptables
Save the current iptables rules in a user specified file.
Ex: sudo iptables-save
Controls the NetworkManager. manages (status, create, edit, etc.) network connections
Ex: nmcli device show
Performs a port scans a hosts on a local network, or a single hosts
Install: sudo apt install nmap
Ex: nmap -sP 10.0.0.0/24
Pings a remote system continuously to see if it responds.
Ex: ping example.com
Syncs files and directories between two hosts.
Ex: rsync -av /source/directoryName /destination/directoryName
Securely copies a file from remote device to local system.
Ex: scp userName@remotehost:filename.ext /local/directoryName/
Securely copies a file from local system to a remote device.
Ex: scp fileName.ext userName@remotehost:/remote/directoryName/
Create a secure console connection to a remote system.
Ex: ssh userName@example.com
Displays network path to the destination, show MTU along the path
Ex: tracepath example.com
Look up the owner information of the domain name.
Ex: whois domainName
Download a file via HTTP/HTTPS.
Ex: wget https://www.example.com/filename.ext
Manage user password expiry information.
Ex: chage --list
Changes the user’s login shell.
Ex: chsh <userName>
Changes user’s name and other details (finger information).
Note: Stored in: /etc/passwd
Ex: chfn
Changes the group ownership of a file or directory.
Ex: chgrp <groupName> fileName.ext
Used to change password for multiple users at a time
Ex: sudo chpasswd
Displays groups that the current user is a member.
Ex: id
Creates a new local group.
Ex: groupadd <groupName>
Creates a gshadow file from the group
Ex: grpconv
Deletes an existing group.
Ex: groupdel
Manage existing groups on the local system.
Ex: groupmod
Displays a list the groups installed on the local system.
Ex: groups
Tip: groups userName (Displays the groups that a user is currently a member)
Manage the /etc/group and /etc/gshadow.
Ex: gpasswd -a userName groupName
Show a listing of last logged in users
Ex: last
Ex: lastb (shows the bad login attempts (from: /var/log/btmp file).
Ex: last reboot ('reboot ' is pseudo user used to log each time the local system is rebooted.)
Changes the password of a user.
Ex [current user]: passwd
Ex [another user]: sudo passwd userName
Creates a new local user.
Ex: useradd <userName>
Deletes a user account and related files on the local system
Ex: userdel <userName>
Modifies a local user account.
Ex: usermod -a -G <groupName> <userName>
Displays the user names of users currently logged in on the local host.
Ex: users
Shows who is logged into the local system.
Ex: who
Lists logged in users on the local system
Ex: w
Displays a text message on the consoles of all currently logged in users.
Ex: wall "Hello, World"
Displays the user name who you're logged in as.
Ex: whoami
Send a message to another user on the local system.
Ex: write <userName>
Displays information about currently logged in users on the local system
Ex: who
=====
Creates a variable.
Ex: TestVariable="Hello, World!" && echo $TestVariable
Tip: unset TestVariable (deletes a variable)
Terminates a for, while and until loop.
Ex: break
Case command, selectively executes commands when a condition is meet.
Syntax: case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac
Ex: a=1; case "$a" in "1") echo "a is 1";; "2") echo "a is 2";; esac
Displays a string of text in the console.
Ex: echo "Hello, World"
If command, executes commands when a condition is meet.
Syntax: if COMMANDS; then COMMANDS; fi
Ex: if true; then echo 'Hello'; fi
Exits a shell function.
Ex: return
FOR command, repeats commands a specific number of times.
Syntax: for NAME [in WORDS ... ;] do COMMANDS; done
Reads the specified file descriptor into the buffer
Ex: echo "what's your age?";read age; echo "Age: $age"
Displays a given string, number or any other format specifier on the console
Ex: printf "%f\n" "5.62" "2.679"
Ex: printf "%s\n" "Hello, World!"
Suspend the execution (in seconds) of a script for an interval of time.
Ex: sleep 10
Reads and executes the contents (i.e. commands) in a file.
Ex: source fileName.ext
Tip: source ~/.bashrc (reloads the .bashrc file)
While command, repeats commands until a TRUE condition is meet.
Syntax: while COMMANDS; do COMMANDS; done
Ex: while true; do echo 'Hello'; done
Until command, repeats commands until a FALSE condition is meet.
Syntax: until COMMANDS; do COMMANDS; done
Ex: until false; do echo 'Hello'; done
Variables Constants
Used for testing TRUE
Ex: true
Used for testing FALSE
Ex: false
Checks a file for spelling errors
Ex: aspell -c fileName.txt
Displays lines that start with the specified string
Note: Default: /usr/share/dict/words
Ex: look ubuntu /etc/passwd
Performs calculation functions.
Note: In interactive mode, type 'quit' to exit.
Ex: echo "10+10" | bc
Displays a monthly or yearly calendar.
Ex: cal
Ex: cal 2020
Clears the console screen.
Tip: Press Ctrl+l
Ex: clear
Displays current date and time.
Ex: date
Evaluates arithmetic expressions in the form of a postfix expression (i.e. entering a number pushed into the stack and followed by operator used to evaluate the expression).
Note: In interactive mode, type 'quit' to exit.
Ex: dc --expression="10 10 + p"
Performs calculation functions (non-interactive).
Ex: expr 10 + 10
Displays factors of a decimal number.
Ex: factor 42
Scans the font directories and builds font cache.
Install: sudo apt install fontconfig
Ex: fc-cache
Lists the available fonts and font styles.
Install: sudo apt install fontconfig
Ex: fc-list
Creates text banners.
Install: sudo apt install figlet
Ex: figlet "Hello, World"
Displays out of the blue poignant, inspirational, or silly phrases.
Ex: fortune
GNU C and C++ Compilers
Install: sudo apt-get install gcc
Ex: gcc new.c -o new && ./new
Install: sudo apt-get install g++
Ex: g++ new.cpp -o new && ./new
Invokes Ghostscript, which is postscript interpreter.
Install: sudo apt-get install ghostscript
Ex: gs -dSAFER fileName.pdf
File Management: Midnight Commander (aka mc) [uses TUI]
Install: sudo apt install mc
Ex: mc
A simple text file editor (much easier to use then VI or VIM).
Ex: nano fileName.ext
A powerful multi-purpose calculator (interactive).
Note: Type qcal -e to update currency, in interactive mode, type: 1 USD to CAD.
Install: sudo apt install qalc
Ex: qalc
Re-initializes the terminal, use if the console is in an abnormal state.
Ex: reset
Records a typescript file, that records all the terminal activities
Ex: script typescriptFile
Replays a typescript/terminal_activity stored in the log file that was recorded by the script command
Ex: scriptreplay timingFile typescriptFile
Allows the launching of multiple shell sessions from a single ssh session
Ex: screen
Displays 'scan', 'key' or 'ascii' code for each key pressed
Note: Press Ctrl-D to quit.
Ex: showkey -a
Generates numbers using, passed parameters FIRST, INCREMENT, LAST
Ex: seq 0 10 100
Ex: seq 1 2 10
Terminal multiplexer (create multiple text consoles)
Ex: tmux
Creates text banners.
Install: sudo apt install toilet
Ex: toilet "Hello, World"
Opens a file or URL in the default application for the resource.
Note: Requires X-Windows.
Ex: xdg-open <fileNameOrURL>
Activates the current screensaver.
Note: Requires X-Windows.
Ex: xdg-screensaver activate
Running any of follow commands will result in a 'kernel panic'. The only way fix this is to reboot the local system.
Ex: dd if=/dev/random of=/dev/port
Ex: echo 1 > /proc/sys/kernel/panic
Ex: cat /dev/port
Ex: cat /dev/zero > /dev/mem
Creates a 'fork bomb', that causes a 'kernel panic' by recursively calls itself multiple times by spawning new child processes in an infinite loop. The only way fix this is to reboot the local system.
Ex: :(){:|:&};:
When you log in to a local system, you loading an interactiveconsole shell (i.e. Bash, Zsh, etc.). These are shells that accept commands, and have the OS execute them. There are two type of shells interactive which can be logged into, and non-interactive (or non-login) which can't be logged into.
Bash supports the following list of script files (i.e. ~/.bashrc) that are automatically executed when the shell starts (or when you log out):
Login Script Files
~/.bashrc
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
Logout Script Files
~/.bash_logout
/etc/bash.bash_logout
By default, shell commands read their input from the STDIN (aka Standard Input stream [0]) and write to the STDOUT (aka Standard Output stream [&1>]), unless there is an error which is written to STDERR (Standard Error stream [&2>]).
The '|' pipe operator, redirects the output of the first command as the input of the second command.
Ex: ls -l | more
The '<' redirects input from another source, other then STDIN.
Ex: sort <(printf "1\n3\n2")
The '>' redirects STDOUT into a file.
Ex: ls -l > fileName.ext
The '&1>' redirects STDOUT into a file.
Ex: ls -l &1> fileName.ext
The '&2>' redirects STDERR into a file.
Ex: ls -l &2> fileName.ext
The '&>' redirects all STDOUT into a file.
Ex: ls -l &> fileName.ext