{"id":114,"date":"2018-07-25T14:05:13","date_gmt":"2018-07-25T10:05:13","guid":{"rendered":"http:\/\/kidds.co.za\/?p=114"},"modified":"2018-07-25T14:43:17","modified_gmt":"2018-07-25T10:43:17","slug":"20-must-know-linux-commands","status":"publish","type":"post","link":"https:\/\/kidds.co.za\/index.php\/2018\/07\/25\/20-must-know-linux-commands\/","title":{"rendered":"20 must know linux commands"},"content":{"rendered":"<p><a href=\"https:\/\/www.tecmint.com\/useful-linux-commands-for-newbies\/\">Original Article tecmint.com<\/a><\/p>\n<h3>1. Command: ls<\/h3>\n<p>The command \u201c<strong>ls<\/strong>\u201d stands for (<strong>List Directory Contents<\/strong>), List the contents of the folder, be it file or folder, from which it runs.<\/p>\n<pre>root@tecmint:~# ls\r\nAndroid-Games                     Music\r\nPictures                          Public\r\nDesktop                           Tecmint.com\r\nDocuments                         TecMint-Sync\r\nDownloads                         Templates<\/pre>\n<p>The command \u201c<strong>ls -l<\/strong>\u201d list the content of folder, in\u00a0<strong>long listing<\/strong>\u00a0fashion.<\/p>\n<pre>root@tecmint:~# ls -l\r\ntotal 40588\r\ndrwxrwxr-x 2 ravisaive ravisaive     4096 May  8 01:06 Android Games\r\ndrwxr-xr-x 2 ravisaive ravisaive     4096 May 15 10:50 Desktop\r\ndrwxr-xr-x 2 ravisaive ravisaive     4096 May 16 16:45 Documents\r\ndrwxr-xr-x 6 ravisaive ravisaive     4096 May 16 14:34 Downloads\r\ndrwxr-xr-x 2 ravisaive ravisaive     4096 Apr 30 20:50 Music\r\ndrwxr-xr-x 2 ravisaive ravisaive     4096 May  9 17:54 Pictures\r\ndrwxrwxr-x 5 ravisaive ravisaive     4096 May  3 18:44 Tecmint.com\r\ndrwxr-xr-x 2 ravisaive ravisaive     4096 Apr 30 20:50 Templates<\/pre>\n<p>Command \u201c<strong>ls -a<\/strong>\u201c, list the content of folder, including\u00a0<strong>hidden<\/strong>\u00a0files starting with \u2018.\u2019.<\/p>\n<pre>root@tecmint:~# ls -a\r\n.\t\t\t.gnupg\t\t\t.dbus\t\t\t.goutputstream-PI5VVW\t\t.mission-control\r\n.adobe                  deja-dup                .grsync                 .mozilla                 \t.themes\r\n.gstreamer-0.10         .mtpaint                .thumbnails             .gtk-bookmarks          \t.thunderbird\r\n.HotShots               .mysql_history          .htaccess\t\t.apport-ignore.xml      \t.ICEauthority           \r\n.profile                .bash_history           .icons                  .bash_logout                    .fbmessenger\r\n.jedit                  .pulse                  .bashrc                 .liferea_1.8             \t.pulse-cookie            \r\n.Xauthority\t\t.gconf                  .local                  .Xauthority.HGHVWW\t\t.cache\r\n.gftp                   .macromedia             .remmina                .cinnamon                       .gimp-2.8\r\n.ssh                    .xsession-errors \t.compiz                 .gnome                          teamviewer_linux.deb          \r\n.xsession-errors.old\t.config                 .gnome2                 .zoncolor<\/pre>\n<p><center><\/center>Note: In\u00a0<strong>Linux<\/strong>\u00a0file name starting with \u2018<strong>.<\/strong>\u2018 is hidden. In Linux every file\/folder\/device\/command is a file. The output of\u00a0<strong>ls -l<\/strong>\u00a0is:<\/p>\n<ol>\n<li><strong>d<\/strong>\u00a0(stands for directory).<\/li>\n<li><strong>rwxr-xr-x<\/strong>\u00a0is the file permission of the file\/folder for owner, group and world.<\/li>\n<li>The 1st\u00a0<strong>ravisaive<\/strong>\u00a0in the above example means that file is owned by user ravisaive.<\/li>\n<li>The 2nd\u00a0<strong>ravisaive<\/strong>\u00a0in the above example means file belongs to user group ravisaive.<\/li>\n<li><strong>4096<\/strong>\u00a0means file size is 4096 Bytes.<\/li>\n<li><strong>May 8 01:06<\/strong>\u00a0is the date and time of last modification.<\/li>\n<li>And at the end is the name of the\u00a0<strong>File\/Folder<\/strong>.<\/li>\n<\/ol>\n<p>For more \u201c<strong>ls<\/strong>\u201d command examples read\u00a0<a href=\"https:\/\/www.tecmint.com\/15-basic-ls-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">15 \u2018ls\u2019 Command Examples in Linux<\/a>.<\/p>\n<h3>2. Command: lsblk<\/h3>\n<p>The \u201c<strong>lsblk<\/strong>\u201d stands for (<strong>List Block Devices<\/strong>), print block devices by their assigned name (but not\u00a0<strong>RAM<\/strong>) on the standard output in a tree-like fashion.<\/p>\n<pre>root@tecmint:~# lsblk\r\nNAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT\r\nsda      8:0    0 232.9G  0 disk \r\n\u251c\u2500sda1   8:1    0  46.6G  0 part \/\r\n\u251c\u2500sda2   8:2    0     1K  0 part \r\n\u251c\u2500sda5   8:5    0   190M  0 part \/boot\r\n\u251c\u2500sda6   8:6    0   3.7G  0 part [SWAP]\r\n\u251c\u2500sda7   8:7    0  93.1G  0 part \/data\r\n\u2514\u2500sda8   8:8    0  89.2G  0 part \/personal\r\nsr0     11:0    1  1024M  0 rom<\/pre>\n<p>The \u201c<strong>lsblk -l<\/strong>\u201d command list block devices in \u2018<strong>list<\/strong>\u2018 structure (not tree like fashion).<\/p>\n<pre>root@tecmint:~# lsblk -l\r\nNAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT\r\nsda    8:0    0 232.9G  0 disk \r\nsda1   8:1    0  46.6G  0 part \/\r\nsda2   8:2    0     1K  0 part \r\nsda5   8:5    0   190M  0 part \/boot\r\nsda6   8:6    0   3.7G  0 part [SWAP]\r\nsda7   8:7    0  93.1G  0 part \/data\r\nsda8   8:8    0  89.2G  0 part \/personal\r\nsr0   11:0    1  1024M  0 rom<\/pre>\n<p>Note:\u00a0<strong>lsblk<\/strong>\u00a0is very useful and easiest way to know the name of\u00a0<strong>New Usb Device<\/strong>\u00a0you just plugged in, especially when you have to deal with disk\/blocks in terminal.<\/p>\n<h3>3. Command: md5sum<\/h3>\n<p>The \u201c<strong>md5sum<\/strong>\u201d stands for (<strong>Compute<\/strong>\u00a0and\u00a0<strong>Check MD5 Message Digest<\/strong>), md5 checksum (commonly called\u00a0<strong>hash<\/strong>) is used to match or verify integrity of files that may have changed as a result of a faulty file transfer, a disk error or non-malicious interference.<\/p>\n<pre>root@tecmint:~# md5sum teamviewer_linux.deb \r\n47790ed345a7b7970fc1f2ac50c97002  teamviewer_linux.deb<\/pre>\n<p>Note: The user can match the generated md5sum with the one provided officially. Md5sum is considered less secure than sha1sum, which we will discuss later.<\/p>\n<h3>4. Command: dd<\/h3>\n<p>Command \u201c<strong>dd<\/strong>\u201d stands for (<strong>Convert<\/strong>\u00a0and\u00a0<strong>Copy a file<\/strong>), Can be used to convert and copy a file and most of the times is used to copy a iso file (or any other file) to a usb device (or any other location), thus can be used to make a \u2018<strong>Bootlable<\/strong>\u2018 Usb Stick.<\/p>\n<pre>root@tecmint:~# dd if=\/home\/user\/Downloads\/debian.iso of=\/dev\/sdb1 bs=512M; sync<\/pre>\n<p>Note: In the above example the usb device is supposed to be sdb1 (You should Verify it using command\u00a0<strong>lsblk<\/strong>, otherwise you will overwrite your disk and OS), use name of disk very Cautiously!!!.<\/p>\n<p><strong>dd<\/strong>\u00a0command takes some time ranging from a few seconds to several minutes in execution, depending on the size and type of file and read and write speed of Usb stick.<\/p>\n<h3>5. Command: uname<\/h3>\n<p>The \u201c<strong>uname<\/strong>\u201d command stands for (<strong>Unix Name<\/strong>), print detailed information about the machine name, Operating System and Kernel.<\/p>\n<pre>root@tecmint:~# uname -a\r\nLinux tecmint 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:36:13 UTC 2013 i686 i686 i686 GNU\/Linux<\/pre>\n<p>Note: uname shows type of kernel.\u00a0<strong>uname -a<\/strong>\u00a0output detailed information. Elaborating the above output of\u00a0<strong>uname -a<\/strong>.<\/p>\n<ol>\n<li>\u201c<strong>Linux<\/strong>\u201c: The machine\u2019s kernel name.<\/li>\n<li>\u201c<strong>tecmint<\/strong>\u201c: The machine\u2019s node name.<\/li>\n<li>\u201c<strong>3.8.0-19-generic<\/strong>\u201c: The kernel release.<\/li>\n<li>\u201c<strong>#30-Ubuntu SMP<\/strong>\u201c: The kernel version.<\/li>\n<li>\u201c<strong>i686<\/strong>\u201c: The architecture of the processor.<\/li>\n<li>\u201c<strong>GNU\/Linux<\/strong>\u201c: The operating system name.<\/li>\n<\/ol>\n<h3>6. Command: history<\/h3>\n<p>The \u201c<strong>history<\/strong>\u201d command stands for\u00a0<strong>History (Event) Record<\/strong>, it prints the history of long list of executed commands in terminal.<\/p>\n<pre>root@tecmint:~# history\r\n1  sudo add-apt-repository ppa:tualatrix\/ppa\r\n2  sudo apt-get update\r\n3  sudo apt-get install ubuntu-tweak\r\n4  sudo add-apt-repository ppa:diesch\/testing\r\n5  sudo apt-get update\r\n6  sudo apt-get install indicator-privacy\r\n7  sudo add-apt-repository ppa:atareao\/atareao\r\n8  sudo apt-get update\r\n9  sudo apt-get install my-weather-indicator\r\n10 pwd\r\n11 cd &amp;&amp; sudo cp -r unity\/6 \/usr\/share\/unity\/\r\n12 cd \/usr\/share\/unity\/icons\/\r\n13 cd \/usr\/share\/unity<\/pre>\n<p>Note: Pressing \u201c<strong>Ctrl + R<\/strong>\u201d and then search for already executed commands which lets your command to be completed with auto completion feature.<\/p>\n<pre>(reverse-i-search)`if': ifconfig<\/pre>\n<h3>7. Command: sudo<\/h3>\n<p>The \u201c<strong>sudo<\/strong>\u201d (<strong>super user do<\/strong>) command allows a permitted user to execute a command as the superuser or another user, as specified by the security policy in the sudoers list.<\/p>\n<pre>root@tecmint:~# sudo add-apt-repository ppa:tualatrix\/ppa<\/pre>\n<p>Note:\u00a0<strong>sudo<\/strong>\u00a0allows user to borrow superuser privileged, while a similar command \u2018<strong>su<\/strong>\u2018 allows user to actually log in as superuser.\u00a0<strong>Sudo<\/strong>\u00a0is safer than\u00a0<strong>su<\/strong>.<br \/>\nIt is not advised to use\u00a0<strong>sudo<\/strong>\u00a0or\u00a0<strong>su<\/strong>\u00a0for day-to-day normal use, as it can result in serious error if accidentally you did something wrong, that\u2019s why a very popular saying in Linux community is:<\/p>\n<pre>\u201cTo err is human, but to really foul up everything, you need root password.\u201d<\/pre>\n<h3>8. Command: mkdir<\/h3>\n<p>The \u201c<strong>mkdir<\/strong>\u201d (<strong>Make directory<\/strong>) command create a new directory with name path. However is the directory already exists, it will return an error message \u201c<strong>cannot create folder, folder already exists\u201d<\/strong>.<\/p>\n<pre>root@tecmint:~# mkdir tecmint<\/pre>\n<p>Note: Directory can only be created inside the folder, in which the user has write permission.\u00a0<strong>mkdir<\/strong>: cannot create directory `<strong>tecmint<\/strong>\u2018: File exists<br \/>\n(Don\u2019t confuse with file in the above output, you might remember what i said at the beginning \u2013 In Linux every file, folder, drive, command, scripts are treated as file).<\/p>\n<h3>9. Command: touch<\/h3>\n<p>The \u201c<strong>touch<\/strong>\u201d command stands for (Update the access and modification times of each\u00a0<strong>FILE<\/strong>\u00a0to the current time).\u00a0<strong>touch<\/strong>\u00a0command creates the file, only if it doesn\u2019t exist. If the file already exists it will update the timestamp and not the contents of the file.<\/p>\n<pre>root@tecmint:~# touch tecmintfile<\/pre>\n<p>Note:\u00a0<strong>touch<\/strong>\u00a0can be used to create file under directory, on which the user has write permission, only if the file don\u2019t exist there.<\/p>\n<h3>10. Command: chmod<\/h3>\n<p>The Linux \u201c<strong>chmod<\/strong>\u201d command stands for (<strong>change file mode bits<\/strong>). chmod changes the file mode (<strong>permission<\/strong>) of each given file, folder, script, etc.. according to mode asked for.<\/p>\n<p>There exist\u00a0<strong>3<\/strong>\u00a0types of permission on a file (folder or anything but to keep things simple we will be using file).<\/p>\n<pre>Read (r)=4\r\nWrite(w)=2\r\nExecute(x)=1<\/pre>\n<p>So if you want to give only read permission on a file it will be assigned a value of \u2018<strong>4<\/strong>\u2018, for write permission only, a value of \u2018<strong>2<\/strong>\u2018 and for execute permission only, a value of \u2018<strong>1<\/strong>\u2018 is to be given. For read and write permission\u00a0<strong>4+2<\/strong>\u00a0= \u2018<strong>6<\/strong>\u2018 is to be given, ans so on.<\/p>\n<p>Now permission need to be set for\u00a0<strong>3<\/strong>\u00a0kinds of user and usergroup. The first is owner, then usergroup and finally world.<\/p>\n<pre>rwxr-x--x   abc.sh<\/pre>\n<p>Here the root\u2019s permission is<strong>\u00a0rwx<\/strong>\u00a0(<strong>read<\/strong>,\u00a0<strong>write<\/strong>\u00a0and\u00a0<strong>execute<\/strong>).<br \/>\nusergroup to which it belongs, is\u00a0<strong>r-x<\/strong>\u00a0(<strong>read<\/strong>\u00a0and\u00a0<strong>execute<\/strong>\u00a0only, no write permission) and<br \/>\nfor world is\u00a0<strong>\u2013x\u00a0<\/strong>(only\u00a0<strong>execute<\/strong>).<\/p>\n<p>To change its permission and provide\u00a0<strong>read<\/strong>,\u00a0<strong>write<\/strong>\u00a0and\u00a0<strong>execute<\/strong>\u00a0permission to owner, group and world.<\/p>\n<pre>root@tecmint:~# chmod 777 abc.sh<\/pre>\n<p>only\u00a0<strong>read<\/strong>\u00a0and\u00a0<strong>write<\/strong>\u00a0permission to all three.<\/p>\n<pre>root@tecmint:~# chmod 666 abc.sh<\/pre>\n<p><strong>read<\/strong>,\u00a0<strong>write<\/strong>\u00a0and\u00a0<strong>execute<\/strong>\u00a0to\u00a0<strong>owner<\/strong>\u00a0and only execute to\u00a0<strong>group<\/strong>\u00a0and\u00a0<strong>world.<\/strong><\/p>\n<pre>root@tecmint:~# chmod 711 abc.sh<\/pre>\n<p>Note: one of the most important command useful for sysadmin and user both. On a multi-user environment or on a server, this command comes to rescue, setting wrong permission will either makes a file inaccessible or provide unauthorized access to someone.<\/p>\n<h3>11. Command: chown<\/h3>\n<p>The Linux \u201c<strong>chown<\/strong>\u201d command stands for (<strong>change file owner and group<\/strong>). Every file belongs to a group of user and a owner. It is used Do \u2018<strong>ls -l<\/strong>\u2018 into your directory and you will see something like this.<\/p>\n<pre>root@tecmint:~# ls -l \r\ndrwxr-xr-x 3 server root 4096 May 10 11:14 Binary \r\ndrwxr-xr-x 2 server server 4096 May 13 09:42 Desktop<\/pre>\n<p>Here the directory\u00a0<strong>Binary<\/strong>\u00a0is owned by user \u201c<strong>server<\/strong>\u201d and it belongs to usergroup \u201c<strong>root<\/strong>\u201d where as directory \u201c<strong>Desktop<\/strong>\u201d is owned by user \u201c<strong>server<\/strong>\u201d and belongs to user group \u201c<strong>server<\/strong>\u201c.<\/p>\n<p>This \u201c<strong>chown<\/strong>\u201d command is used to change the file ownership and thus is useful in managing and providing file to authorised user and usergroup only.<\/p>\n<pre>root@tecmint:~# chown server:server Binary\r\ndrwxr-xr-x 3 server server 4096 May 10 11:14 Binary \r\ndrwxr-xr-x 2 server server 4096 May 13 09:42 Desktop<\/pre>\n<p>Note: \u201c<strong>chown<\/strong>\u201d changes the user and group ownership of each given\u00a0<strong>FILE<\/strong>\u00a0to\u00a0<strong>NEW-OWNER<\/strong>\u00a0or to the user and group of an existing reference file.<\/p>\n<h3>12. Command: apt<\/h3>\n<p>The Debian based \u201c<strong>apt<\/strong>\u201d command stands for (<strong>Advanced Package Tool<\/strong>).\u00a0<strong>Apt<\/strong>\u00a0is an advanced package manager for\u00a0<strong>Debian<\/strong>\u00a0based system (<strong>Ubuntu<\/strong>,\u00a0<strong>Kubuntu<\/strong>, etc.), that automatically and intelligently\u00a0<strong>search<\/strong>,\u00a0<strong>install<\/strong>,\u00a0<strong>update<\/strong>\u00a0and\u00a0<strong>resolves dependency<\/strong>\u00a0of packages on\u00a0<strong>Gnu\/Linux<\/strong>\u00a0system from command line.<\/p>\n<pre>root@tecmint:~# apt-get install mplayer\r\nReading package lists... Done\r\nBuilding dependency tree       \r\nReading state information... Done\r\nThe following package was automatically installed and is no longer required:\r\njava-wrappers\r\nUse 'apt-get autoremove' to remove it.\r\nThe following extra packages will be installed:\r\nesound-common libaudiofile1 libesd0 libopenal-data libopenal1 libsvga1 libvdpau1 libxvidcore4\r\nSuggested packages:\r\npulseaudio-esound-compat libroar-compat2 nvidia-vdpau-driver vdpau-driver mplayer-doc netselect fping\r\nThe following NEW packages will be installed:\r\nesound-common libaudiofile1 libesd0 libopenal-data libopenal1 libsvga1 libvdpau1 libxvidcore4 mplayer\r\n0 upgraded, 9 newly installed, 0 to remove and 8 not upgraded.\r\nNeed to get 3,567 kB of archives.\r\nAfter this operation, 7,772 kB of additional disk space will be used.\r\nDo you want to continue [Y\/n]? y<\/pre>\n<pre>root@tecmint:~# apt-get update\r\nHit http:\/\/ppa.launchpad.net raring Release.gpg                                           \r\nHit http:\/\/ppa.launchpad.net raring Release.gpg                                           \r\nHit http:\/\/ppa.launchpad.net raring Release.gpg                      \r\nHit http:\/\/ppa.launchpad.net raring Release.gpg                      \r\nGet:1 http:\/\/security.ubuntu.com raring-security Release.gpg [933 B] \r\nHit http:\/\/in.archive.ubuntu.com raring Release.gpg                                                   \r\nHit http:\/\/ppa.launchpad.net raring Release.gpg                      \r\nGet:2 http:\/\/security.ubuntu.com raring-security Release [40.8 kB]   \r\nIgn http:\/\/ppa.launchpad.net raring Release.gpg                                                  \r\nGet:3 http:\/\/in.archive.ubuntu.com raring-updates Release.gpg [933 B]                            \r\nHit http:\/\/ppa.launchpad.net raring Release.gpg                                                                \r\nHit http:\/\/in.archive.ubuntu.com raring-backports Release.gpg<\/pre>\n<p>Note: The above commands results into system-wide changes and hence requires root password (Check \u2018<strong>#<\/strong>\u2018 and not \u2018<strong>$\u2019<\/strong>\u00a0as prompt).\u00a0<strong>Apt<\/strong>\u00a0is considered more advanced and intelligent as compared to\u00a0<a href=\"https:\/\/www.tecmint.com\/20-practical-examples-of-rpm-commands-in-linux\/\" target=\"_blank\" rel=\"noopener\">yum command<\/a>.<\/p>\n<p>As the name suggest,\u00a0<strong>apt-cache<\/strong>\u00a0search for package containing sub package\u00a0<strong>mpalyer<\/strong>.\u00a0<strong>apt-get<\/strong>\u00a0install, update all the packages, that are already installed, to the newest one.<\/p>\n<p>Read more about apt-get and apt-cache commands at\u00a0<a href=\"https:\/\/www.tecmint.com\/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management\/\" target=\"_blank\" rel=\"noopener\">25 APT-GET and APT-CACHE Commands<\/a><\/p>\n<h3>13. Command: tar<\/h3>\n<p>The \u201c<strong>tar<\/strong>\u201d command is a\u00a0<strong>Tape Archive<\/strong>\u00a0is useful in creation of archive, in a number of file format and their extraction.<\/p>\n<pre>root@tecmint:~# tar -zxvf abc.tar.gz (Remember '<strong>z<\/strong>' for <strong>.tar.gz<\/strong>)<\/pre>\n<pre>root@tecmint:~# tar -jxvf abc.tar.bz2 (Remember '<strong>j<\/strong>' for <strong>.tar.bz2<\/strong>)<\/pre>\n<pre>root@tecmint:~# tar -cvf archieve.tar.gz(<strong>.bz2<\/strong>) \/path\/to\/folder\/abc<\/pre>\n<p>Note: A \u2018<strong>tar.gz<\/strong>\u2018 means gzipped. \u2018<strong>tar.bz2<\/strong>\u2018 is compressed with bzip which uses a better but slower compression method.<\/p>\n<p>Read more about \u201ctar command\u201d examples at\u00a0<a href=\"https:\/\/www.tecmint.com\/18-tar-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">18 Tar Command Examples<\/a><\/p>\n<h3>14. Command: cal<\/h3>\n<p>The \u201c<strong>cal<\/strong>\u201d (<strong>Calendar<\/strong>), it is used to displays calendar of the present month or any other month of any year that is advancing or passed.<\/p>\n<pre>root@tecmint:~# cal \r\nMay 2013        \r\nSu Mo Tu We Th Fr Sa  \r\n1  2  3  4  \r\n5  6  7  8  9 10 11  \r\n12 13 14 15 16 17 18  \r\n19 20 21 22 23 24 25  \r\n26 27 28 29 30 31<\/pre>\n<p>Show calendar of year\u00a0<strong>1835<\/strong>\u00a0for month\u00a0<strong>February<\/strong>, that already has passed.<\/p>\n<pre>root@tecmint:~# cal 02 1835\r\nFebruary 1835      \r\nSu Mo Tu We Th Fr Sa  \r\n1  2  3  4  5  6  7  \r\n8  9 10 11 12 13 14  \r\n15 16 17 18 19 20 21  \r\n22 23 24 25 26 27 28<\/pre>\n<p>Shows calendar of year\u00a0<strong>2145<\/strong>\u00a0for the month of\u00a0<strong>July<\/strong>, that will advancing<\/p>\n<pre>root@tecmint:~# cal 07 2145\r\nJuly 2145        \r\nSu Mo Tu We Th Fr Sa  \r\n1  2  3  \r\n4  5  6  7  8  9 10  \r\n11 12 13 14 15 16 17  \r\n18 19 20 21 22 23 24  \r\n25 26 27 28 29 30 31<\/pre>\n<p>Note: You need not to turn the calendar of\u00a0<strong>50<\/strong>\u00a0years back, neither you need to make complex mathematical calculation to know what day you were worn or your coming birthday will fall on which day.<\/p>\n<h3>15. Command: date<\/h3>\n<p>The \u201c<strong>date<\/strong>\u201d (<strong>Date<\/strong>) command print the current date and time on the standard output, and can further be set.<\/p>\n<pre>root@tecmint:~# date\r\nFri May 17 14:13:29 IST 2013<\/pre>\n<pre>root@tecmint:~# date --set='14 may 2013 13:57' \r\nMon May 13 13:57:00 IST 2013<\/pre>\n<p>Note: This Command will be very use-full in scripting, time and date based scripting, to be more perfect. Moreover changing date and time using terminal will make you feel\u00a0<strong>GEEK<\/strong>!!!. (Obviously you need to be\u00a0<strong>root<\/strong>\u00a0to perform this operation, as it is a system wide change).<\/p>\n<h3>16. Command: cat<\/h3>\n<p>The \u201c<strong>cat<\/strong>\u201d stands for (<strong>Concatenation<\/strong>). Concatenate (join) two or more plain file and\/or print contents of a file on standard output.<\/p>\n<pre>root@tecmint:~# cat a.txt b.txt c.txt d.txt &gt;&gt; abcd.txt<\/pre>\n<pre>root@tecmint:~# cat abcd.txt\r\n....\r\ncontents of file abcd \r\n...<\/pre>\n<p>Note: \u201c<strong>&gt;&gt;<\/strong>\u201d and \u201c<strong>&gt;<\/strong>\u201d are called append symbol. They are used to append the output to a file and not on standard output. \u201c<strong>&gt;<\/strong>\u201d symbol will delete a file already existed and create a new file hence for security reason it is advised to use \u201c<strong>&gt;&gt;<\/strong>\u201d that will write the output without overwriting or deleting the file.<\/p>\n<p>Before Proceeding further, I must let you know about wildcards (you would be aware of wildcard entry, in most of the Television shows) Wildcards are a shell feature that makes the command line much more powerful than any\u00a0<strong>GUI<\/strong>\u00a0file managers. You see, if you want to select a big group of files in a graphical file manager, you usually have to select them with your mouse. This may seem simple, but in some cases it can be very frustrating.<\/p>\n<p>For example, suppose you have a directory with a huge amount of all kinds of files and subdirectories, and you decide to move all the HTML files, that have the word \u201cLinux\u201d somewhere in the middle of their names, from that big directory into another directory. What\u2019s a simple way to do this? If the directory contains a huge amount of differently named HTML files, your task is everything but simple!<\/p>\n<p>In the Linux CLI that task is just as simple to perform as moving only one HTML file, and it\u2019s so easy because of the shell wildcards. These are special characters that allow you to select file names that match certain patterns of characters. This helps you to select even a big group of files with typing just a few characters, and in most cases it\u2019s easier than selecting the files with a mouse.<\/p>\n<p>Here\u2019s a list of the most commonly used wildcards :<\/p>\n<pre><strong>Wildcard<\/strong>\t\t\t<strong>Matches<\/strong>\r\n*\t\t\tzero or more characters\r\n?\t\t\texactly one character\r\n[abcde]\t\t\texactly one character listed\r\n[a-e]\t\t\texactly one character in the given range\r\n[!abcde]\t\tany character that is not listed\r\n[!a-e]\t\t\tany character that is not in the given range\r\n{debian,linux}\t\texactly one entire word in the options given<\/pre>\n<p><strong>!<\/strong>\u00a0is called not symbol, and the reverse of string attached with \u2018!\u2019 is true.<\/p>\n<p>Read more examples of Linux \u201ccat command\u201d at\u00a0<a href=\"https:\/\/www.tecmint.com\/13-basic-cat-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">13 Cat Command Examples in Linux<\/a><\/p>\n<h3>17. Command: cp<\/h3>\n<p>The \u201c<strong>copy<\/strong>\u201d stands for (<strong>Copy<\/strong>), it copies a file from one location to another location.<\/p>\n<pre>root@tecmint:~# cp \/home\/user\/Downloads abc.tar.gz \/home\/user\/Desktop (Return 0 when sucess)<\/pre>\n<p>Note:\u00a0<strong>cp<\/strong>\u00a0is one of the most commonly used command in shell scripting and it can be used with wildcard characters (Describe in the above block), for customised and desired file copying.<\/p>\n<h3>18. Command: mv<\/h3>\n<p>The \u201c<strong>mv<\/strong>\u201d command moves a file from one location to another location.<\/p>\n<pre>root@tecmint:~# mv \/home\/user\/Downloads abc.tar.gz \/home\/user\/Desktop (Return 0 when sucess)<\/pre>\n<p>Note:\u00a0<strong>mv<\/strong>\u00a0command can be used with wildcard characters.\u00a0<strong>mv<\/strong>\u00a0should be used with caution, as moving of system\/unauthorised file may lead to security as well as breakdown of system.<\/p>\n<h3>19. Command: pwd<\/h3>\n<p>The command \u201c<strong>pwd<\/strong>\u201d (<strong>print working directory<\/strong>), prints the current working directory with full path name from terminal.<\/p>\n<pre>root@tecmint:~# pwd \r\n\/home\/user\/Desktop<\/pre>\n<p>Note: This command won\u2019t be much frequently used in scripting but it is an absolute life saver for newbie who gets lost in terminal in their early connection with nux. (<strong>Linux<\/strong>\u00a0is most commonly referred as\u00a0<strong>nux<\/strong>\u00a0or\u00a0<strong>nix<\/strong>).<\/p>\n<h3>20. Command: cd<\/h3>\n<p>Finally, the frequently used \u201c<strong>cd<\/strong>\u201d command stands for (<strong>change directory<\/strong>), it change the working directory to execute, copy, move write, read, etc. from terminal itself.<\/p>\n<pre>root@tecmint:~# cd \/home\/user\/Desktop<\/pre>\n<pre>server@localhost:~$ pwd\r\n\/home\/user\/Desktop<\/pre>\n<p>Note:\u00a0<strong>cd<\/strong>\u00a0comes to rescue when switching between directories from terminal. \u201c<strong>Cd ~<\/strong>\u201d will change the working directory to user\u2019s home directory, and is very useful if a user finds himself lost in terminal. \u201c<strong>Cd ..<\/strong>\u201d will change the working directory to parent directory (of current working directory).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Original Article tecmint.com 1. Command: ls The command \u201cls\u201d stands for (List Directory Contents), List the contents of the folder, be it file or folder, from which it runs. root@tecmint:~# ls Android-Games Music Pictures Public Desktop Tecmint.com Documents TecMint-Sync Downloads Templates The command \u201cls -l\u201d list the content of folder, in\u00a0long listing\u00a0fashion. root@tecmint:~# ls -l [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,2],"tags":[],"class_list":["post-114","post","type-post","status-publish","format-standard","hentry","category-general-commands","category-linux"],"_links":{"self":[{"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/comments?post=114"}],"version-history":[{"count":2,"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":116,"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/posts\/114\/revisions\/116"}],"wp:attachment":[{"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/media?parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/categories?post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kidds.co.za\/index.php\/wp-json\/wp\/v2\/tags?post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}