{"id":9299,"date":"2019-02-08T15:14:55","date_gmt":"2019-02-08T15:14:55","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=9299"},"modified":"2019-02-10T06:05:40","modified_gmt":"2019-02-10T06:05:40","slug":"the-linux-command-line-cheat-sheet","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/02\/08\/the-linux-command-line-cheat-sheet\/","title":{"rendered":"The Linux Command-Line Cheat Sheet"},"content":{"rendered":"<h3>This select set of Linux commands can help you master the command line and speed up your use of the operating system.<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/images.idgesg.net\/images\/article\/2019\/02\/crib-sheet_cheat-sheet_answers_tests_notes-100787270-large.jpg\" alt=\"The Linux command-line cheat sheet\" \/><\/p>\n<p>When coming up to speed as a Linux user, it helps to have a cheat sheet that can help introduce you to some of the more useful commands.<\/p>\n<p>In the tables below, you\u2019ll find sets of commands with simple explanations and usage examples that might help you or Linux users you support become more productive on the command line.<\/p>\n<h2>Getting familiar with your account<\/h2>\n<p>These commands will help new Linux users become familiar with their Linux accounts.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>pwd<\/td>\n<td>Displays your current location in the file system<\/td>\n<td>pwd<\/td>\n<\/tr>\n<tr>\n<td>whoami<\/td>\n<td>Displays your username\u00a0\u2013 most useful if you switch users with\u00a0<strong>su<\/strong>\u00a0and need to be reminded what account you&#8217;re using currently<\/td>\n<td>whoami<\/td>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>Provides a file listing. With\u00a0<strong>-a<\/strong>, it also displays files with names starting with a period (e.g., .bashrc). With\u00a0<strong>-l<\/strong>, it also displays file permissions, sizes and last updated date\/time.<\/td>\n<td>ls<br \/>\nls -a<br \/>\nls -l<\/td>\n<\/tr>\n<tr>\n<td>env<\/td>\n<td>Displays your user environment settings (e.g., search path, history size, home directory, etc.)<\/td>\n<td>env<\/td>\n<\/tr>\n<tr>\n<td>echo<\/td>\n<td>Repeats the text you provide or displays the value of some variable<\/td>\n<td>echo hello<br \/>\necho $PATH<\/td>\n<\/tr>\n<tr>\n<td>history<\/td>\n<td>Lists previously issued commands<\/td>\n<td>history<br \/>\nhistory | tail -5<\/td>\n<\/tr>\n<tr>\n<td>passwd<\/td>\n<td>Changes your password. Note that complexity requirements may be enforced.<\/td>\n<td>passwd<br \/>\nhistory | tail -5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Examining files<\/h2>\n<p>Linux provides several commands for looking at the content and nature of files. These are some of the most useful commands.<\/p>\n<section class=\"bodee\">\n<div id=\"drr-container\" class=\"cat \">\n<p>When coming up to speed as a Linux user, it helps to have a cheat sheet that can help introduce you to some of the more useful commands.<\/p>\n<p>In the tables below, you\u2019ll find sets of commands with simple explanations and usage examples that might help you or Linux users you support become more productive on the command line.<\/p>\n<h2>Getting familiar with your account<\/h2>\n<p>These commands will help new Linux users become familiar with their Linux accounts.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>pwd<\/td>\n<td>Displays your current location in the file system<\/td>\n<td>pwd<\/td>\n<\/tr>\n<tr>\n<td>whoami<\/td>\n<td>Displays your username\u00a0\u2013 most useful if you switch users with\u00a0<strong>su<\/strong>\u00a0and need to be reminded what account you&#8217;re using currently<\/td>\n<td>whoami<\/td>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>Provides a file listing. With\u00a0<strong>-a<\/strong>, it also displays files with names starting with a period (e.g., .bashrc). With\u00a0<strong>-l<\/strong>, it also displays file permissions, sizes and last updated date\/time.<\/td>\n<td>ls<br \/>\nls -a<br \/>\nls -l<\/td>\n<\/tr>\n<tr>\n<td>env<\/td>\n<td>Displays your user environment settings (e.g., search path, history size, home directory, etc.)<\/td>\n<td>env<\/td>\n<\/tr>\n<tr>\n<td>echo<\/td>\n<td>Repeats the text you provide or displays the value of some variable<\/td>\n<td>echo hello<br \/>\necho $PATH<\/td>\n<\/tr>\n<tr>\n<td>history<\/td>\n<td>Lists previously issued commands<\/td>\n<td>history<br \/>\nhistory | tail -5<\/td>\n<\/tr>\n<tr>\n<td>passwd<\/td>\n<td>Changes your password. Note that complexity requirements may be enforced.<\/td>\n<td>passwd<br \/>\nhistory | tail -5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Examining files<\/h2>\n<p>Linux provides several commands for looking at the content and nature of files. These are some of the most useful commands.<\/p>\n<div class=\"teads-inread\">\n<div>\n<div id=\"teads0\" class=\"teads-player\"><\/div>\n<\/div>\n<\/div>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>cat<\/td>\n<td>Displays the entire contents of a text file.<\/td>\n<td>cat .bashrc<\/td>\n<\/tr>\n<tr>\n<td>more<\/td>\n<td>Displays the contents of a text file one screenful at a time. Hit the spacebar to move to each additional chunk.<\/td>\n<td>more .bash_history<\/td>\n<\/tr>\n<tr>\n<td>less<\/td>\n<td>Displays the contents of a text file one screenful at a time, but in a manner that allows you to back up using the up arrow key.<\/td>\n<td>less .bash_history<\/td>\n<\/tr>\n<tr>\n<td>file<\/td>\n<td>Identifies files by type (e.g., ASCII text, executable, image, directory)<\/td>\n<td>file myfile<br \/>\nfile ~\/.bashrc<br \/>\nfile \/bin\/echo<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Managing files<\/h2>\n<p>These are some Linux commands for changing file attributes as well as renaming, moving and removing files.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>chmod<\/td>\n<td>Changes file permissions (who can read it, whether it can be executed, etc.)<\/td>\n<td>chmod a+x myscript<br \/>\nchmod 755 myscript<\/td>\n<\/tr>\n<tr>\n<td>chown<\/td>\n<td>Changes file owner<\/td>\n<td>sudo chown jdoe myfile<\/td>\n<\/tr>\n<tr>\n<td>cp<\/td>\n<td>Makes a copy of a file.<\/td>\n<td>cp origfile copyfile<\/td>\n<\/tr>\n<tr>\n<td>mv<\/td>\n<td>Moves or renames a file\u00a0\u2013 or does both<\/td>\n<td>mv oldname newname<br \/>\nmv file \/new\/location<br \/>\nmv file \/newloc\/newname<\/td>\n<\/tr>\n<tr>\n<td>rm<\/td>\n<td>Deletes a file or group of files<\/td>\n<td>rm file<br \/>\nrm *.jpg<br \/>\nrm -r directory<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Creating and editing files<\/h2>\n<p>Linux systems provide commands for creating files and directories. Users can choose the text editor they are comfortable using. Some require quite a bit of familiarity before they&#8217;ll be easy to use while others are fairly self-explanatory.<\/p>\n<aside id=\"\" class=\"nativo-promo nativo-promo-1 smartphone\"><\/aside>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>nano<\/td>\n<td>An easy-to-use text editor that requires you to move around in the file using your arrow keys and provides control sequences to locate text, save your changes, etc.<\/td>\n<td>nano myfile<\/td>\n<\/tr>\n<tr>\n<td>vi<\/td>\n<td>A more sophisticated editor that allows you to enter commands to find and change text, make global changes, etc.<\/td>\n<td>vi myfile<\/td>\n<\/tr>\n<tr>\n<td>ex<\/td>\n<td>A text editor designed for programmers and has both a line-oriented and visual mode<\/td>\n<td>ex myfile<\/td>\n<\/tr>\n<tr>\n<td>touch<\/td>\n<td>Creates a file if it doesn&#8217;t exist or updates its timestamp if it does<\/td>\n<td>touch newfile<br \/>\ntouch updatedfile<\/td>\n<\/tr>\n<tr>\n<td>&gt;<\/td>\n<td>Creates files by directing output to them. A single &gt; creates a file while &gt;&gt; appends to an existing file.<\/td>\n<td>cal &gt; calendar<br \/>\nps &gt; myprocs<br \/>\ndate &gt;&gt; date.log<\/td>\n<\/tr>\n<tr>\n<td>mkdir<\/td>\n<td>Creates a directory<\/td>\n<td>mkdir mydir<br \/>\nmkdir ~\/mydir<br \/>\nmkdir \/tmp\/backup<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Moving around the file system<\/h2>\n<p>The command for moving around the Linux file system is\u00a0<strong>ls<\/strong>, but there are many variations.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>cd<\/td>\n<td>With no arguments, takes you to your home directory. The same thing would happen if you typed\u00a0<strong>cd $HOME<\/strong>or\u00a0<strong>cd ~<\/strong><\/td>\n<td>cd<\/td>\n<\/tr>\n<tr>\n<td>cd ..<\/td>\n<td>Moves up (toward \/) one directory from your current location<\/td>\n<td>cd ..<\/td>\n<\/tr>\n<tr>\n<td>cd &lt;location&gt;<\/td>\n<td>Takes you to the specified location. If the location begins with a\u00a0<strong>\/<\/strong>, it is taken to be relative to the root directory; otherwise it is taken as being relative to your current location. The\u00a0<strong>~<\/strong>\u00a0character represents your home directory.<\/td>\n<td>cd \/tmp<br \/>\ncd Documents<br \/>\ncd ~\/Documents<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Learning about and identifying commands<\/h2>\n<p>There are a number of Linux commands that can help you learn about other commands, the options they offer and where these commands are are located in the file system. Linux systems also provide a command that can help you to learn what commands are available related to some subject\u00a0\u2013 for example, commands that deal with user accounts.<\/p>\n<\/div>\n<\/section>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>man<\/td>\n<td>Displays the manual (help) page for a specified command and (with\u00a0<strong>-k<\/strong>) provides a list of commands related to a specified keyword<\/td>\n<td>man cd<br \/>\nman -k account<\/td>\n<\/tr>\n<tr>\n<td>which<\/td>\n<td>Displays the location of the executable that represents the particular command<\/td>\n<td>which cd<\/td>\n<\/tr>\n<tr>\n<td>apropos<\/td>\n<td>Lists commands associated with a particular topic or keyword<\/td>\n<td>apropos user<br \/>\napropos account<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Finding files<\/h2>\n<p>There are two commands that can help you find files on Linux, but they work very differently. One searches the file system while the other looks through a previously built database.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"8\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"40\">Example<\/th>\n<\/tr>\n<tr>\n<td>find<\/td>\n<td>Locates files based on criteria provided (file name, type, owner, permissions, size, etc.). Unless provided with a location from which to start the search, find only looks in the current directory.<\/td>\n<td>find . -name myfile<br \/>\nfind \/tmp -type d<\/td>\n<\/tr>\n<tr>\n<td>locate<\/td>\n<td>Locates files using the contents of the \/var\/lib\/mlocate\/mlocate.db which is updated by the\u00a0<strong>updatedb<\/strong>\u00a0command usually run through cron. No starting location is required.<\/td>\n<td>locate somefile<br \/>\nlocate &#8220;*.html&#8221; -n 20<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Viewing running processes<\/h2>\n<p>You can easily view processes that are running on the system\u00a0\u2013 yours, another user&#8217;s or all of them.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>ps<\/td>\n<td>Shows processes that you are running in your current login session<\/td>\n<td>ps<\/td>\n<\/tr>\n<tr>\n<td>ps -ef<\/td>\n<td>Shows all processes that are currently running on the system<\/td>\n<td>ps -ef<br \/>\nps -ef | more<\/td>\n<\/tr>\n<tr>\n<td>pstree<\/td>\n<td>Shows running processes in a hierarchical (tree-like) display that demonstrates the relationships between processes (-h highlights current process)<\/td>\n<td>pstree<br \/>\npstree username<br \/>\npstree -h<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Starting, stopping and listing services<\/h2>\n<p>These commands allow you to display services as well as start and stop them.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>systemctl<\/td>\n<td>The\u00a0<strong>systemctl<\/strong>\u00a0command can start, stop, restart and reload services. Privileged access is required.<\/td>\n<td>sudo systemctl stop apache2.service<br \/>\nsudo systemctl restart apache2.service<br \/>\nsudo systemctl reload apache2.service<\/td>\n<\/tr>\n<tr>\n<td>service<\/td>\n<td>Lists services and indicates whether they are running<\/td>\n<td>service &#8211;status-all<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Killing processes<\/h2>\n<p>Linux offers a few commands for terminating processes. Privileged access is needed if you did not start the process in question.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>kill<\/td>\n<td>Terminates a running process provided you have the authority to do so<\/td>\n<td>kill 8765<br \/>\nsudo kill 1234<br \/>\nkill -9 3456<\/td>\n<\/tr>\n<tr>\n<td>killall<\/td>\n<td>Terminates all processes with the provided name<\/td>\n<td>killall badproc<\/td>\n<\/tr>\n<tr>\n<td>pkill<\/td>\n<td>Terminates a process based on its name<\/td>\n<td>pkill myproc<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Identifying your OS release<\/h2>\n<p>The table below lists commands that will display details about the Linux OS that is running on a system.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>uname<\/td>\n<td>Displays information on OS release in a single line of text<\/td>\n<td>uname -a<br \/>\nuname -r<\/td>\n<\/tr>\n<tr>\n<td>lsb_release<\/td>\n<td>On\u00a0<strong>Debian-based<\/strong>\u00a0systems, this command displays information on the OS release including its codename and distributor ID<\/td>\n<td>lsb_release -a<\/td>\n<\/tr>\n<tr>\n<td>hostnamectl<\/td>\n<td>Displays information on the system including hostname, chassis type, OS, kernel and architecture<\/td>\n<td>hostnamectl<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Gauging system performance<\/h2>\n<p>These are some of the more useful tools for examining system performance.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>top<\/td>\n<td>Shows running processes along with resource utilization and system performance data. Can show processes for one selected user or all users. Processes can be ordered by various criteria (CPU usage by default)<\/td>\n<td>top<br \/>\ntop jdoe<\/td>\n<\/tr>\n<tr>\n<td>atop<\/td>\n<td>Similar to top command but more oriented toward system performance than individual processes<\/td>\n<td>atop<\/td>\n<\/tr>\n<tr>\n<td>free<\/td>\n<td>Shows memory and swap usage\u00a0\u2013 total, used and free<\/td>\n<td>free<\/td>\n<\/tr>\n<tr>\n<td>df<\/td>\n<td>Display file system disk space usage<\/td>\n<td>df<br \/>\ndf -h<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Managing users and groups<\/h2>\n<p>Commands for creating and removing user accounts and groups are fairly straightforward.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>useradd<\/td>\n<td>Adds a new user account to the system. A username is mandatory. Other fields (user description, shell, initial password, etc.) can be specified. Home directory will default to \/home\/username.<\/td>\n<td>useradd -c &#8220;John Doe&#8221; jdoe<br \/>\nuseradd -c &#8220;Jane Doe&#8221; -g admin -s \/bin\/bash jbdoe<\/td>\n<\/tr>\n<tr>\n<td>userdel<\/td>\n<td>Removes a user account from the system. The\u00a0<strong>-f<\/strong>option runs a more forceful removal, deleting the home and other user files even if the user is still logged in.<\/td>\n<td>userdel jbdoe<br \/>\nuserdel -f jbdoe<\/td>\n<\/tr>\n<tr>\n<td>groupadd<\/td>\n<td>Adds a new user group to the system, updating the\u00a0<strong>\/etc\/group<\/strong>.<\/td>\n<td>groupadd developers<\/td>\n<\/tr>\n<tr>\n<td>groupdel<\/td>\n<td>Removes a user group from the system<\/td>\n<td>groupdel developers<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Examining network connections<\/h2>\n<p>The commands below help you view network interfaces and connections.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>ip<\/td>\n<td>Displays information on network interfaces<\/td>\n<td>ip a<\/td>\n<\/tr>\n<tr>\n<td>ss<\/td>\n<td>Displays information on sockets. The\u00a0<strong>-s<\/strong>\u00a0option provides summary stats. The\u00a0<strong>-l<\/strong>\u00a0option shows listening sockets. The\u00a0<strong>-4<\/strong>\u00a0or\u00a0<strong>-6<\/strong>\u00a0options restrict output to IPv4 or IPv6 connections.<\/td>\n<td>ss -s<br \/>\nss -l<br \/>\nss -4 state listening<\/td>\n<\/tr>\n<tr>\n<td>ping<\/td>\n<td>Check connectivity to another system<\/td>\n<td>ping remhost<br \/>\nping 192.168.0.11<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Managing security<\/h2>\n<p>There are many aspects to managing security on a Linux system, but there are also a lot of commands that can help. The commands below are some that will get you started. Click on this link to see these and other commands on\u00a0<a href=\"https:\/\/www.networkworld.com\/article\/3272286\/open-source-tools\/22-essential-security-commands-for-linux.html\">22 essential Linux security commands<\/a>.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>visudo<\/td>\n<td>The visudo command allows you to configure privileges that will allow select individuals to run certain commands with superuser authority. The command does this by making changes to the\u00a0<strong>\/etc\/sudoers<\/strong>\u00a0file.<\/td>\n<td>visudo<\/td>\n<\/tr>\n<tr>\n<td>sudo<\/td>\n<td>The sudo command is used by privileged users (as defined in the\u00a0<strong>\/etc\/sudoers<\/strong>\u00a0file to run commands as root.<\/td>\n<td>sudo useradd jdoe<\/td>\n<\/tr>\n<tr>\n<td>su<\/td>\n<td>Switches to another account. This requires that you know the user&#8217;s password or can use\u00a0<strong>sudo<\/strong>\u00a0and provide your own password. Using the\u00a0<strong>&#8211;<\/strong>\u00a0means that you also pick up the user&#8217;s environment settings.<\/td>\n<td>su (switch to root)<br \/>\nsu &#8211; jdoe<br \/>\nsudo su &#8211; jdoe<\/td>\n<\/tr>\n<tr>\n<td>who<\/td>\n<td>Shows who is logged into the system<\/td>\n<td>who<\/td>\n<\/tr>\n<tr>\n<td>last<\/td>\n<td>Lists last logins for specified user using records from the\u00a0<strong>\/var\/log\/wtmp<\/strong>\u00a0file.<\/td>\n<td>last jdoe<\/td>\n<\/tr>\n<tr>\n<td>ufw<\/td>\n<td>Manages the firewall on\u00a0<strong>Debian-based<\/strong>\u00a0systems.<\/td>\n<td>sudo ufw status<br \/>\nsudo ufs allow ssh<br \/>\nufw show<\/td>\n<\/tr>\n<tr>\n<td>firewall-cmd<\/td>\n<td>Manages the firewall (firewalld) on\u00a0<strong>RHEL<\/strong>\u00a0and related systems.<\/td>\n<td>firewall-cmd &#8211;list-services<br \/>\nfirewall-cmd &#8211;get-zones<\/td>\n<\/tr>\n<tr>\n<td>iptables<\/td>\n<td>Displays firewall rules.<\/td>\n<td>sudo iptables -vL -t security<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Setting up and running scheduled processes<\/h2>\n<p>Tasks can be scheduled to run periodically using the command listed below.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>crontab<\/td>\n<td>Sets up and manages scheduled processes. With the\u00a0<strong>-l<\/strong>\u00a0option, cron jobs are listed. With the\u00a0<strong>-e<\/strong>option, cron jobs can be set up to run at selected intervals.<\/td>\n<td>crontab -l<br \/>\ncrontab -l -u username<br \/>\ncrontab -e<\/td>\n<\/tr>\n<tr>\n<td>anacron<\/td>\n<td>Allows you to run scheduled jobs on a daily basis only. If the system is powered off when a job is supposed to run, it will run when the system boots.<\/td>\n<td>sudo vi \/etc\/anacrontab<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Updating, installing and listing applications<\/h2>\n<p>The commands for installing and updating applications depend on what version of Linux you are using, specifically whether it&#8217;s Debian- or RPM-based.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>apt update<\/td>\n<td>On\u00a0<strong>Debian-based<\/strong>\u00a0systems, updates the list of available packages and their versions, but does not install or upgrade any packages<\/td>\n<td>sudo apt update<\/td>\n<\/tr>\n<tr>\n<td>apt upgrade<\/td>\n<td>On\u00a0<strong>Debian-based<\/strong>\u00a0systems, installs newer versions of installed packages<\/td>\n<td>sudo apt upgrade<\/td>\n<\/tr>\n<tr>\n<td>apt list<\/td>\n<td>Lists all packages installed on\u00a0<strong>Debian-based<\/strong>system. With\u00a0<strong>&#8211;upgradable<\/strong>\u00a0option, it shows only those packages for which upgrades are available.<\/td>\n<td>apt list<br \/>\napt list &#8211;installed<br \/>\napt list &#8211;upgradable<\/td>\n<\/tr>\n<tr>\n<td>apt install<\/td>\n<td>On\u00a0<strong>Debian-based<\/strong>\u00a0systems, installs requested package<\/td>\n<td>sudo apt install apache2<\/td>\n<\/tr>\n<tr>\n<td>yum update<\/td>\n<td>On\u00a0<strong>RPM-cased<\/strong>\u00a0systems, updates all or specified packages<\/td>\n<td>sudo yum update<br \/>\nyum update mysql<\/td>\n<\/tr>\n<tr>\n<td>yum list<\/td>\n<td>On\u00a0<strong>RPM-based<\/strong>\u00a0systems, lists package<\/td>\n<td>sudo yum update mysql<\/td>\n<\/tr>\n<tr>\n<td>yum install<\/td>\n<td>On\u00a0<strong>RPM-based<\/strong>\u00a0systems, installs requested package<\/td>\n<td>sudo yum -y install firefox<\/td>\n<\/tr>\n<tr>\n<td>yum list<\/td>\n<td>On\u00a0<strong>RPM-based<\/strong>\u00a0systems, lists known and installed packages<\/td>\n<td>sudo yum list<br \/>\nsudo yum list &#8211;installed<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Shutting down and rebooting<\/h2>\n<p>Commands for shutting down and rebooting Linux systems require privileged access. Options such as\u00a0<strong>+15<\/strong>\u00a0refer to the number of minutes that the command will wait before doing the requested shutdown.<\/p>\n<table border=\"15px\">\n<tbody>\n<tr>\n<th width=\"15\">Command<\/th>\n<th width=\"45\">Function<\/th>\n<th width=\"25\">Example<\/th>\n<\/tr>\n<tr>\n<td>shutdown<\/td>\n<td>Shuts down the system at the requested time. The\u00a0<strong>-H<\/strong>\u00a0option halts the system while the\u00a0<strong>-P<\/strong>\u00a0powers it down as well.<\/td>\n<td>sudo shutdown -H now<br \/>\nshutdown -H +15<br \/>\nshutdown -P +5<\/td>\n<\/tr>\n<tr>\n<td>halt<\/td>\n<td>Shuts down the system at the requested time.<\/td>\n<td>sudo halt<br \/>\nsudo halt -p<br \/>\nsudo halt &#8211;reboot<\/td>\n<\/tr>\n<tr>\n<td>poweroff<\/td>\n<td>Powers down the system at the requested time.<\/td>\n<td>sudo shutdown -H now<br \/>\nsudo shutdown -H +15<br \/>\nsudo shutdown -P +5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Wait, wait, there&#8217;s more!<\/h2>\n<p>Remember to consult the man pages for more details on these commands. A cheat sheet provides only a quick explanation and a handful of command examples to help you get started.<\/p>\n<p><a href=\"https:\/\/www.linux.com\/learn\/linux-command-line-cheat-sheet\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This select set of Linux commands can help you master the command line and speed up your use of the operating system. When coming up to speed as a Linux user, it helps to have a cheat sheet that can help introduce you to some of the more useful commands. In the tables below, you\u2019ll &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/02\/08\/the-linux-command-line-cheat-sheet\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The Linux Command-Line Cheat Sheet&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9299","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/9299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=9299"}],"version-history":[{"count":2,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/9299\/revisions"}],"predecessor-version":[{"id":9466,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/9299\/revisions\/9466"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=9299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=9299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=9299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}