Linux Commands Linux Commands for Navigating files Clear – the clear command clears your screen or terminal. Pwd - Ctrl + L is another command used to clear your screen. pwd stands for “print working directory”. The command shows the current location in the file system that you are in. Ls - ls Used to show the contents of the current directory or Tab key autocompletes for you. e.g. cat boo + press your tab key will autocomplete it for you and return book.txt if you have such file. folder. Linux Commands for Managing files Cd cd – stands for change directory. The command is used to change your location in the session. touch - touch + filename - is used to create a file without any cd + your Directoryname or foldername – will change directory to the file path that you place as an argument. e.g. cd mynewdirectory or cd mercury. cd . – a single dot can be used to refer to the current directory. content. The file created using the touch command is empty. This command can be used when the user doesn’t have data to store at the time of file creation. e.g. touch ibt.txt echo - echo is used to display line of text/string that are passed. The Echo output goes to a default place called “standard output”, or “stdout”, pronounced standard out. By default, stdout is printed to your terminal or shell cd .. – two dots can be used to refer to the directory one hierarchy level above the current one or the directory you are in. You can move up multiple directories at once e.g cd ../.../../.. Using cd by itself or cd ~ will move you to your home directory. cd / - will take you to the root directory. The / is known as the root directory. man – man stands for manual, it can be used to find the manual for a Linux command. e.g. man ls, man pwd, man touch e.t.c q – typing the letter q in a man page will close or exit the man page > The echo output can be redirected to a file using the > operator: For example – echo “IBT is cool” > ibt.txt will move the output to the ibt file rather than the stdout. NOTE: The > operator will replace the contents of an existing file. >> If you want to append or add to the content of an existing file, rather than replacing its contents, you can use the >> operator e.g. echo “IBT is a great learning platform” >> ibt.txt. cat – cat + filename will show the contents of a file e.g cat ibt.txt. cat can be used to show the contents of multiple files. rm - Used to remove files mv - used to rename files e.g. mv book.txt ibt.txt used to move files from one location to another. Syntax - mv origin destination When moving a file to a directory or moving folders with mv, you add the forward slash / e.g. mv ibt.txt ibt5/, for folders/directories, mv ibt4 ibt5 mkdir directoryname - Used to create a directory (folders) e.g. mkdir myfirstdirectory. rmdir directoryname - used to remove directories but only empty directories. rmdir ibtispecial. Linux Commands and flags Most commands come with flags that add additional functionality to the original commands. Flags can be grouped together e.g. ls – ls, rm –ri e.t.c. ls below are some useful ls flags and their functions. -a Shows files that start with the dot or period sign i.e. hidden files -l Shows long listing description of a file: file permissions, owner, size of file, date last modified, and path. -t Sorts files by most recent to latest modified. -h Shows file size in readable format. (Needs to be used in conjunction with h) -r Reverses the order, alphabetically, or based on other flag cp - used to make copies of files combining ls with all its flags is normal practice e.g ls -ltrah cp filename copyname - will create a new file or a copy of the original file with whatever copyname you gave it rm Hidden files/directories These files/directories start with the period or dot sign . e.g. touch .ibt.txt or mkdir .anotherdirectory Functions as normal files and directories though can’t be seen. Hidden files Can only be viewed with ls –a command rm flags and functions -r Recursively deletes files/directories. No prompts ! -i Prompt before every removal. -f Forcefully delete all files. Rm is commonly used as rm –rf or rm -ri rmdir rmdir -p Creates parent directories as necessary. e.g mkdir –p ibt/bobo/ibt3 will create what could be termed as nested directories. cp cp flags and functions -R recursively copies files/directories. -n Prevents overwriting of files history the history command will show a history of all the commands typed in the session. history -c clears your history history + a number, will show the most recent commands according to the number you typed. e.g. history 10 will show the most recent 10 commands used. Reverse search Ctrl + r, used to search back through most recent commands. Ctrl + s, used to search forward through most recent commands. (If Ctrl + s, does not work that is because in some Linux distributions Ctrl + s is usually reserved for another function (software control flow). To disable software control flow use the following command “stty –ixon” and Ctrl + s should allow you to perform a forward search. To renable software control flow use the “ssty ixon” command.) Pressing ctrl + r, once in search toggles through occurrences of the command entered. Esc, to exit Enter, to run command * * Known as wildcard matches one or more occurrences of any character, including no character. Can be used to match file patterns, Example: *a, matches anything with ending with a abc*, matches anything starting with abc cab*c, matches anything starting with ab and ending in ? ? Can represent any arbitrary character. Example: B?rn will match Born, Barn, Bern B?rn, will not match Bearn, Boorn \ \- Escape a special character. grep | (pipe operator) Tells shell to interpret what would normally be an operator as a character e.g. \*start.txt Searches for matching text/text patterns. It is case sensitive. grep flags -i, case insensitive search -c, counts the number of lines for a given match Can be used with multiple files. REGULAR EXPRESSION OR REGEX Used to search through complex string patterns. They are commonly used with grep . - Matches any single character (except newlines, normally) e.g app.e will return apple. * - Matches up zero or more times the preceding character. This symbol is different from wildcard when used in regex. Example: xy*z will match xyz, xyyz, xyyyyz, ^ - Used to find all the strings that starts with the given character Sends output of one command to another for further processing. It can be used to combine two or more commands in a chained fashion. See example below. command_1 | command_2 | command_3 | .... | command_N e.g history | grep ls sudo Stands for ”superuser do” sudo su, starts a session or switches you to the root user Use exit to log out of sudo Sudo vi or nano /etc/sudoers – takes you to the sudoers file where all the sudo permissions are automatically added by default. groups – tells you what group you belong and with this example: ^book as in bookworm. command, you will know if you belong to the sudo command if Sudo were listed among the group. $ - Used to find all the strings that end with the given character. groups user – shows you the group the user belongs to. e.g. k$ , berry$ means these words must end with the letter k Example: groups root, group username. Sudo –l tells you what commands can run or privileges you as in book or berry as in Strawberry. have. Sudo !! – allows you to run the previous command on your terminal with sudo. Su Stands for switch user, login to another session Example: su ubuntu, su bobo, su yourname Sudo ALL(ALL : ALL) ALL 1st ALL tells you which host can use sudo 2nd ALL refers to the user you are allowed to impersonate 3rd ALL refers to the group you are allowed to impersonate Last ALL tells you the commands that the user is allowed to run with sudo. NOPASSWD: , removes password requirement when using sudo, a space after the colon is a must. Sudo visudo The best practice for editing sudoers file is using sudo visudo. If there be any syntax error: e – allows you to re-edit the file x – allows you to exit without saving changes q – saves the invalid changes Add user to sudoers file to add a user to the sudoers file with all permissions. You do as follows. It means this current user can only use the sudo ls command and nothing else. whoami Shows the user of the current session. Which – the which command tells you the path for a particular command. E.g which ls Users To add users – sudo adduser username Change user password - passwd (works if you are logged in as the user) sudo passwd username (works as root). To delete user - sudo userdel username System configuration file for users: /etc/passwd Groups Add new group - sudo groupadd groupname Add users to a group - sudo adduser userx groupname Username ALL(ALL : ALL) ALL Delete user from a group - sudo deluser userx groupname To restrict permissions, the last all can be edited to whatever command you want to give to the user by using the path. See example below: Username ALL(ALL : ALL) usr/bin/ls Delete a group - sudo groupdel groupname System configuration file for users: /etc/group chmod command - chmod identifier add/remove permissions. NB: Adding a user to the sudo group allows them to use sudo. Identifiers U - owner G - group O - other Operators Changes apply to the next login of the user. You can use usermod – aG sudo + username to add a user to a sudo group also File permissions r - read w - write x - execute File Types - normal file +, adds permissions , -, removes permissions = sets permissions Permissions r - read w - write x – execute Changing Permissions d - directory c - character special file b - binary special file sudo chmod ugo+rwx filename.txt Adds read write and execute permissions to filename.txt for owner, group, and others sudo chmod go-w filename.txt chown Removes write permisions for filename.txt for group and others. sudo chmod u=rwx,o-wx foldername. sudo chown newuser filename/foldername -R, recursively changes ownership for all files/directories inside the directory. Sets owner permissions to read, write and execute, and removes write and execute permissions from others. chgrp sudo chgrp newgroup filename/foldername -R, recursively changes ownership for all files/directories inside the directory. Changing Permissions Octal notation rwx 7 rw_ 6 r_x 5 r__4 _wx 3 _w_ 2 _ _x 1 ___0 Sudo apt-cache search + your keyword – lets you search for any keyword in package repositories chmod 777 filename.txt dnf (older versions yum) The first number is for the owner The second number is for the group. The third number is for other Dnf search – used to synchronise system with current cat /etc/os-release – tells you what linux distribution you are using. Which – the which command is used to locate the executable 2) fedora repositories. dnf upgrade – used for upgrade dnf install packagename – installs any packages dnf remove packagename – removes any packages but not the file associated with the given command by searching it in the path environmental variable e.g. which ls, which rm etc. dependencies. dnf autoremove – removes all dependencies Package manager dnf search + your keyword – lets you search for any keyword in package repositories. Note: Pacman and rpm are package managers for other linux 1) Debian/ubuntu distributions. Sudo apt update – used to synchronise system with current repositories. Text editors Sudo apt upgrade – used for upgrade 1) Nano Sudo apt install packagename – installs any packages Nano – typing the word nano takes you to the nano text editor Sudo apt remove packagename – removes any packages but not the dependencies. Sudo apt autoremove – removes all dependencies and starts a new file. Nano filename – opens the file using nano. “^” symbol stands for Ctrl on the nano screen. Ctrl + o, is used to save a file. Ctrl + x, is used to exit a file. Ctrl + w, allows you to search forward Ctrl + q, allows you to backward vi has 3 modes (command, insertion and extended modes) note: you are in command mode by default and it is read-only. Esc – switches to command mode. I – switches to insertion mode : - switches to extended mode Ctrl + k, allows you to cut Navigating Vi/Vim Ctrl + u, allows you to paste gg – goes to the top of the file Ctrl + c, shows you location shift + g - goes to the bottom of a file. :set number – shows line number in extended mode. :set nonumber – hides line number in extended mode. ## + shift + g – takes you to a line number. Ctrl + w, shows help menu yy – copies current line. Tip: you can find all nano commands when you type Ctrl +g X – starts deleting Ctrl + w -> Ctrl +t , takes you to a specific line P – pastes and some these commands are also displayed at the footer section of the nano text editor. dd – cuts a line Nano +number filename – opens the file at a set line number. e – jumps forward to the end of a word. Nano –v filename - allows you to have a view only nano text editor. No editing is allowed on this mode 2) vi/vim vi – typing vi by itself opens a new file vi filename – will open that file with vi text editor U – undo Ctrl + r , redo b – jumps backward to the start of a word. 0 – jumps forward to the end of a line. $ - jumps backward to the start a line. J – lets you go down through the lines k – lets you go up through the lines O – inserts a line above (switches to insertion mode) o or shift o– inserts a line below ( switches to insertion mode) :/the word to be searched – it’s used for searching in extended mode. n – goes to the next occurrence of the searched word N – goes to the previous occurence quitting vi/vim ensure you are in extended mode when quitting vi/vim :q , exits (only works if no changes were made). :wq, exits and saves the file. :q!, exits and ignores all changes to the file. :wq filename, exits and saves the file when creating a new file for the first time. VIM CHEATSHEET (for all vi/vim commands, check the link below) To be persistently set for than one user, use the global environment variable with the use of a text editor. vi /etc/environment. Sudo privileges can also be used to set the variable using a text editor e.g. sudo vi /etc/environment. Then use the source command, source /etc/environment. Source filename executes scripts in the current environment. Then printenv variable that you set. Unset variablename – deletes the variable for the current session. To persistently delete a global environmental variable, it is done by deleting it from the text editor. Environment variables File archiving/compression File archivers/compressors includes tar, zip, gzip tar – bundles the files into a tarball (it doesn’t compress) zip – compresses files gzip – compresses just a single file How to view EV gzip and flags https://vim.rtorr.com/ env – prints all environment variables printenv + variablename or echo $variablename will print a specific environment variable. Example: printenv Home or echo $Home. How to set EV Temporary environment variables: Export VAR= value, it exports the variable to the environment only for the current session. Export MYVAR = “this is myvar”. The value of the variable can be overridden by the export command when we re-assign a different value to the variable. To persistently set it for just the current user. Use the source .bashrc command. First the variable must be added to the .bashrc file using a text editor before using the source command and then printenv variablename. gzip filename – compresses the original file -k , prevents the original file from being compressed -r, recursively zips all files in a directory -d, unzips a compressed file -I, gives information about compressed file tar tar takes a large number of files and saves them to a single archive or a tar ball. Tar doesn’t compress the archive but it can use the z flag to do so if needed. It uses the below flags to give extra functions. -z, uses gzip to compress/uncompress a file -c, creates archive -f, establish file name -v, (verbose) outputs command logs -x, used to unarchive common usage: to archive, you use tar –cvf filename.tar filename to aechive and compress, you use tar –czvf filename.tar filename to unarchive, you use tar –xvf filename.tar to archive and decompress, you use tar –xvzf filename.tar to gzip a tar ball or archive, you use gzip filename.tar zip zip is used to compress files in order to decrease the size of the file. Zip archivename filename1 filename 2 e.g zip ibtlearning.zip test1 test2 test3 unzip unzip archivename to unzip files e.g unzip ibtlearning.zip unzip can be used with the below flags -r, recursive -q, suppresses logs -l, list contents of zipped files -x filename, excludes a file from being unzipped e.g unzip ibtlearning.zip –x test1. This command unzips or extracts test2 and test3 but exclude test1 ps a process is associated with any program running on your system and is used to manage and monitor a program’s memory usage, processor time, and I/O resources. Ps, can be used to see all processes in the current session. It can be used with the below flags Ps x Ps –He Ps –axjf Ps aux You can also use grep to filter out a particular process running when using the ps command. Example below. Ps aux | grep Jenkins, Will tell you if Jenkins is running or not. Process monitoring (top) top, is used to show the Linux processes. It provides a dynamic realtime view of the running system. Typing the word “top” on your terminal will give you a graphical user interface of the linux process real time it gives you the below: Uptime, how long it’s been up Amount of users logged in Resource usage statistics(overall and per process) Arrow keys to go up and down Shift + M, sort by memory usage Shift + N, sort by PID Shift + T, Sort by TIME Shift + P, sort by CPU U user, shows processes by user E, change memory units for system wide memory e, change memory units for processes t, toggling t shows CPU graph m, toggling m shows CPU graph Ctrl + c to exit or just press q to quit Kill Kill all processname, kills a process by process name Kill pid, kills a process by PID Date Date, shows you current date Crontab, Crontab allows you to schedule tasks ahead of time and on a repeated basis. It is uses below flags Crontab: -l, shows all cronjobs for current user -e, allows you to to pick a text editor to use for the first time -u, allows you to specify what user to edit crontab for. Location of crontab is below: /etc/crontab to set up a cron job, type the below and scroll to the bottom: crontab –e to get cron syntax for a cron job, you can utilize crontab guru website https://crontab.guru SSH Ssh stands for secure shell protocol, is a remote administration protocol that allows users access , control, and modify their remote servers over the internet. See syntax below ssh user@ip/hostname (if you created a config file) or ssh –i “~/.ssh/private key” user@ip/hostname ssh default port is 22 and its config file is stored in ~/.ssh/config rsync it synchronizes files from one location to another. Rysnc – [options] source destination -v, verbose -a, (archive mode) copies directories recursively and keeps permissions, makes source and destination more of an exact match. --dry-run, simulates rysnc without making actual changes rynsc -av - -dry-run /home/user/directoryname user@ip/hostname:/home/user ifconfig ifconfig, shows network devices (hardware of software), you can find your ip address here also. netstat netstat, is used to show server connections or ports being used. If not installed, you can use “sudo apt install net-tools” to install it. -a, shows listening and non-listening network connections and sockets. -l, shows listening network connections and sockets -ta, shows listening and non-listening TCP connections -u, shows listening and non-listening UDP connections -p, shows PID for connection. -r, shows routing table -q, displays all connections -e, displays Ethernet statistics -s, displays per-protocal statistics -f, displays fully qualified domain names for foreign addresses. -o, shows the owning process ID associated with each connections Curl Curl over is used to make requests to servers, it enables data transfer various network protocols. It communicates with a web or application server by specifying a relevant URL and the data that need to be sent or received. Curl hostname e.g. curl https://google.com Curl –v hostname Curl –o filename hostname, will download the content of the hostname. E.g. curl –o google www.google.com Curl –help, will show you all the flags you can use with curl and their functions. Ping Ping, is used to check the network connectivity. Ping hostname e.g. ping www.google.com Tail Tail is a command which prints the last few number of lines (10 lines by default) of files. Tail ibt.txt With the n flag, you can specify numbers of lines you want to be printed from the file Tail –n 5 ibt.txt less The less command is used when the output printed by any command is larger than the screen space and needs scrolling. The less command allows users to break down the output and scroll through it with the use of the enter or space keys. the less commands gives you a screen view of your file when the space key is used for scrolling. example usage less .bashrc press 'q' to quit uname The uname command is used to print basic system information. It is usually invoked with the -a option to display all available information basic syntax below: The sort command will provide a sorted output of the contents of a file. sort filename uniq uname -a The uniq (unique) utility displays a file, skipping adjacent duplicate lines; it does not change the original file. uniq filename diff file The command will compare data between two text files and display the difference. diff file1 file2 You can use the file utility to learn about the contents of any file on cmp cmp command in Linux/UNIX is used to compare two files byte by byte and helps you to find out whether the two files are identical or not. cmp file1 file2 comm The comm command is a simple Linux utility for comparing files with focus on the common content comm file1 file2 Sort a Linux system without having to open and examine the file yourself. file filename id Print real and effective user and group IDs groupmod The groupmod command modifies the definition of the specified GROUP by modifying the appropriate entry in the group database. groupmod option group setfacl This utility sets Access Control Lists (ACLs) of files and directories. It is useful to give individual permission to users and groups as chmod assigns permission of file level but here we have more control over each user permission setfacl options file getfacl For each file, getfacl displays the file name, owner, the group, and the Access Control List (ACL). If a directory has a default ACL, getfacl also displays the default ACL getfacl filename ncdu ncdu - provides a useful and convenient way to view disk usage. service df is one of the most important Linux commands. With the help of this command, users can retrieve all the data of their file system just by running the df command in the Linux Terminal window. See example usage df filename it is used used with the –h flag to present a human readable output df –h filename df and Mount When working with Linux, the df and mount commands are very efficient utilities to mount filesystems and get details of the file system. mount, allows us to connect the device to a folder so we can access the files from our filesystem. The default syntax to mount a filesystem is below: mount /dev/cdrom /mnt The service command in Linux is used for starting and stopping different services within the operating system. The basic syntax of the command is as below. Traceroute When working with traceroute, you can simply specify the IP address, the hostname or the domain name of the endpoint. service servicename start e.g traceroute localhost service servicename status service servicename stop wget df If you want to download a file from within the terminal, the wget command is one of the handiest command-line utilities available. wget <link to the file> wget -c <link to the file> -c, the c flag allows us to resume an interrupted download ufw and iptables UFW and IPTables are firewall interfaces for the Linux Kernel’s netfilter firewall. IPTables directly passes firewall rules to netfilter while UFW configures the rules in IPTables which then sends those rules to netfilter. As the name suggests, the unalias command aims to remove an alias from the already defined aliases. To remove the previous la alias, you can use: unalias ls, unalias cls. whereis ufw allow 8080 The whereis command will output the exact location of any command that you type in after the whereis command e.g whereis ls cal, whatis shows you calender on your terminal The whatis command gives us an explanation of what a command actually is. Similar to the whereis command e.g. whatis sudo Alias alias is a defined name you give for your most used linux commands without having to type the actual command always. e.g. ls="ls -a" cd cd - takes you back to your previous directory cls="clear" cp -R If you want to list all the aliases you have in your shell session, you can run the alias command without argument. You can also copy entire directories by using the recursive flag: cp -r dir-to-copy/ new-dir/ Unalias mv You use the mv command to move (or rename) files and directories through your file system. To use this command, you’d type its name with the source and destination files: mv source_file destination_folder/ mv command_list.txt commands/ To utilize absolute paths, you’d use: The exit command does exactly what its name suggests: With it, you can end a shell session or quit remote ssh sessions. htop htop is an interactive process viewer that lets you manage your machine’s resources directly from the terminal. press "q" to quit htop shred This command overrides the contents of a file repeatedly, and as a result, the given file becomes extremely difficult to recover. mv /home/user/file_to_move ./ …where ./ is the directory you’re currently in. shred -uv filename it uses a few flags, use shred --help to get the needed flags wc You also can use mv to rename files while keeping them in the same directory: Wc stands for “word count,” and as the name suggests, it returns the number of words in a text file. wc filename. mv old_file.txt new_named_file.txt exit neofetch neofetch is a CLI tool that displays information about your system — like kernel version, shell, and hardware. it can be installed with your package manager as it is not available by default. For example, if using ubuntu, it is: sudo apt install neofetch or when it is necessary to change the login password from time to time. chage --help will give the necesary flags you can use. find The find command searches for files in a directory hierarchy based on a regex expression. To use it, follow the syntax below: find [flags] [path] -name [expression] To search for a file named long.txt in the current directory, enter this: find ./ -name "long.txt" # ./long.txt free The free command is used to generate information about memory usage. It calculates for both the main Random Access Memory (RAM) and swap memory. free -h will give you output in a human readable form. free --help will show you all the flags you can use with free. chage The chage command is used to view and change the user password expiry information. see example usage below. chage -l yourUsername This command is usually used when the login is to be provided for a user for a limited amount of time finger The finger command is used to look up and obtain brief information on users finger username traceroute The traceroute command tracks the route that a particular packet of information takes to reach to the host. traceroute wwww.google.com ifup The ifup command used to bring the network interface up and enable it to transfer and receive data. awk The awk command is a Linux tool and programming language that allows users to process and manipulate data and produce formatted reports awk '{print}' example.txt locate gpg -c filename locate will find all files and directories with a particular name. it gives you the absolute path to the file locate filename. to decrypt a file, use gpg as below Create a symbolic link to a file: ln -s /path/to/[file_name] [link_name] more to show the content of a file. it is similar to cat more filename cat can also show the content of a file. cat filename or path to the file cat can also be used to append the content of a file unto a different file cat file1 >> file2 gpg gpg command is used to encrypt a file. it will prompt for a paraphrase gpg filename.gpg enable The enable command is a built-in shell command. enable - a will list all enabled builtins shell commands, whether they are enabled or not cut The cut command in UNIX is a command for cutting out the sections from each line of files and writing the result to standard output. see example usage cut -b 1,2,3 filename source it is a built in shell command that Reads and executes the file content in the current shell. e.g. create a file, put commands like ls -ltrah, date e.t.c inside the file and source the file. source filename Date typing date on your terminal will display current date and time id id command gives you the details about active users uptime Displays how long the system has been running, including the load average. last last will show you the last system logins. hostname shows your hostname when used with the -i flag, it will display your I.P address instead who Print information about users who are currently logged in w w will show which user is logged in and their activities pstree pstree shows processes in a tree-like diagram: bg bg Lists and resume stopped jobs in the background: fg fg brings the most recently suspended job to the foreground fg job will Bring a particular job to the foreground: lsof List files opened by running processes with the lsof command wait wait command is used to Pause terminal or a Bash script until a running process is completed. last reboot will List the system reboot history df -h See free and used space on mounted systems: df -i Show free inodes on mounted filesystems: fdisk -l Display disk partitions, sizes, and types with the command: df -ah gives disk usage for all files and directory df -sh show disk usage of the directory you are currently in. findmnt Display target mount point for all filesystem ip addr show List IP addresses and network interfaces ifconfig Display IP addresses of all network interfaces with whois Display more information about a domain e.g. Set a custom interval to run a user-defined command e.g. watch -n 5 date whois domain_name will display your current date and time every 5 seconds dig Show DNS information about a domain using the dig command: dig domain_name bc allows you to enable command line calculator in Linux Terminal when you execude following command. you can do your add, sub, mult and div using bc dig -x ip address Do reverse lookup of an IP address: nslookup Receive information about an internet domain e.g. nslookup domain_name set List the names of all the shell variables and functions: sleep Postpone the execution of a command sleep time_of_sleep && command. see example usage sleep 5 && ls ctrl + c Kill process running in the terminal: ctrl + z Stop current process watch lscpu This command will display all the CPU architecture information such as threads, sockets, cores and CPU count. lshw sudo lshw command can be used to invoke detailed hardware information of the system on which Linux is running. iostat The iostat command in Linux is used for monitoring system input/output statistics for devices and partitions. iostat is being included in sysstat package. If you don’t have it, install it first using your relevant package manager. sudo apt install sysstat (for Ubuntu) exit exit command can be used to close the Terminal shell window directly from the command-line. expr Set a custom interval to run a user-defined command e.g. watch -n 5 date will display your current date and time every 5 seconds bc allows you to enable command line calculator in Linux Terminal when you execude following command. you can do your add, sub, mult and div using bc lscpu This command will display all the CPU architecture information such as threads, sockets, cores and CPU count. used to perform quick calculations on the terminal whilst you are working. e.g. expr 50 + 50 vmstat vmstat command will display systems virtual memory usage on Terminal window. dstat dstat - allows you to view all of your system resources instantly. Allin-one vmstat, iostat, netstat, and ifstat utility. lshw sudo lshw command can be used to invoke detailed hardware information of the system on which Linux is running. mpstat When executed mpstat command will display all the information about CPU utilization and performance stats on Linux Terminal window. nproc nproc command will display the number of processing units allotted to the currently running process. iostat The iostat command in Linux is used for monitoring system input/output statistics for devices and partitions. scp scp which means Secure Copy protocol is the Linux command which can be used to copy files and directories iostat is being included in sysstat package. If you don’t have it, install it first using your relevant package manager. sudo apt install sysstat (for Ubuntu) between hosts on the network. see example usage below exit exit command can be used to close the Terminal shell window directly from the command-line. expr scp ibt.txt user@destination_host:/home/ scp user1@host1:/location/ibt.txt user2@host2:/location stat view the status of a file or an entire file system using stat <file or file system name> command in Linux Terminal. stat filename nohup nohup - short for no hang up is a command in Linux systems that keep processes running even after exiting the shell or terminal.