{"id":43,"date":"2023-01-30T14:16:23","date_gmt":"2023-01-30T14:16:23","guid":{"rendered":"https:\/\/tutorials.darkworld.network\/?p=43"},"modified":"2023-01-30T17:07:55","modified_gmt":"2023-01-30T17:07:55","slug":"linux-commands","status":"publish","type":"post","link":"https:\/\/tutorials.darkworld.network\/?p=43","title":{"rendered":"Linux Commands"},"content":{"rendered":"\r\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/tutorials.darkworld.network\/wp-content\/uploads\/2023\/01\/linux-300x300.png\" alt=\"\" width=\"300\" height=\"300\" \/><\/p>\r\n\r\n\r\n\r\n<figure>\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>Commands<\/th>\r\n<th>Description<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>ls<\/td>\r\n<td>To list down all the contents of directory<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cd<\/td>\r\n<td>To change the directory<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cd \/bin\/<\/td>\r\n<td>Change current directory to bin directory<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cd ~<\/td>\r\n<td>The tilde (~) sign signifies the user\u2019s home dir \u2013 change dir to home directory<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cd ..<\/td>\r\n<td>It changes directory one level up<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>mkdir<\/td>\r\n<td>To create a directory<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>pwd<\/td>\r\n<td>It display current directory path<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cat &lt;filename&gt;<\/td>\r\n<td>Command to print all the contents of provided filename on the screen<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cp<\/td>\r\n<td>It copies the file or directory<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cp \/home\/dw \/home\/linux<\/td>\r\n<td>It copies the \/home\/dw\/ directory to \/home\/linux\/ directory<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>mv<\/td>\r\n<td>mv move command is used to move files and directories<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>mv \/home\/dw\/info.txt \/newDirectoryName\/<\/td>\r\n<td>It moves the file info.txt to the \/newDirectoryName\/ directory. You can also use this command to move the entire directory to another Directory<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>rm<\/td>\r\n<td>rm command is used to remove files and directories.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>rm info.txt<\/td>\r\n<td>This command will remove the file info.txt<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>find<\/td>\r\n<td>find command perform search of file<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>find \/ -name \u201clinux*\u201d<\/td>\r\n<td>The find command is a powerful tool that you can use when searching using the command line. The command here will search for any file or directory with a name that starts with linux<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>uname -a<\/td>\r\n<td>This command displays information about the machine, the processor architecture, and the operating system details.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>lscpu<\/td>\r\n<td>This command returns more information about the system such as the number of CPUs and the CPU speed<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cat \/proc\/cpuinfo<\/td>\r\n<td>This is a file that contains more information than the one displayed using the lscpu command<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>df -h<\/td>\r\n<td>This command displays the disk space usage in all of the mounted devices. The -h option presents the results in a human readable output, using G for gigabytes or M for megabytes sizes<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>du ~\/Downloads<\/td>\r\n<td>This command displays all the files inside the specified directory and their corresponding file sizes. You can also specify a filename<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>du ~\/Downloads -sh<\/td>\r\n<td>The \u2013s option provides the total file size of the specified directory and -h makes it human readable form<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/figure>\r\n\r\n\r\n\r\n<figure>\r\n<table style=\"height: 1936px;\" width=\"1307\">\r\n<thead>\r\n<tr>\r\n<th>Keys<\/th>\r\n<th>Description<\/th>\r\n<th>Example<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>info<\/td>\r\n<td>Shows online information about a command<\/td>\r\n<td>$ info uname<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>man<\/td>\r\n<td>Shows details (manual) of a command<\/td>\r\n<td>$ man uname<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>whatis<\/td>\r\n<td>Shows a short description of a specific keyword<\/td>\r\n<td>$ whatis uname<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>type<\/td>\r\n<td>Shows the location of a command file<\/td>\r\n<td>$ type uname<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>alias<\/td>\r\n<td>Assign a command alias \u2013 especially useful for long commands<\/td>\r\n<td>$ alias t=type $ t uname $ alias<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>unalias<\/td>\r\n<td>Remove command alias<\/td>\r\n<td>$ unalias t<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>pwd<\/td>\r\n<td>Displays the current directory<\/td>\r\n<td>$ pwd<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>ln<\/td>\r\n<td>Create links to files and directories<\/td>\r\n<td>$ ln -s [file] [soft-link-to-file] $ ln -s info.txt newinfo.txt<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>touch<\/td>\r\n<td>To trigger a file stamp update for a file<\/td>\r\n<td>$ touch info.txt<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>find<\/td>\r\n<td>Search for a file based on the name<\/td>\r\n<td>$ find [dir-path] -name [filename] $ find . -name info.jpeg<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>whereis<\/td>\r\n<td>Search for executable files<\/td>\r\n<td>$ whereis uname<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>which<\/td>\r\n<td>Search for files in the directories part of the PATH variable<\/td>\r\n<td>$ which uname<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>dd<\/td>\r\n<td>Copy lines of data<\/td>\r\n<td>$ dd conv=ucase Type Hello world ctrl+d $ echo \u201chello world &gt; info.txt $ dd if=info.txt of=newinfo.txt conv=ucase $ cat newinfo.txt<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>diff<\/td>\r\n<td>Display the results of comparing two files<\/td>\r\n<td>$ echo \u201chello world &gt; info.txt $ echo \u201chello world &gt; info1.txt $ diff info.txt info1.txt -s $ echo \u201chello world123 &gt; newinfo.txt $ diff info.txt newinfo.txt -s<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>more<\/td>\r\n<td>Show a text file one page at a time \u2013 display can only go forward<\/td>\r\n<td>$ ls -R &gt; info.txt $ more info.txt $ ls -R | more<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>less<\/td>\r\n<td>Show a text file one page at a time \u2013 display can only go forward and backwards<\/td>\r\n<td>$ less info.txt $ ls -R | less<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>wc<\/td>\r\n<td>Display the count of the number of characters, words, and lines in a file<\/td>\r\n<td>$ wc info.txt<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cut<\/td>\r\n<td>Get sections of text in a file<\/td>\r\n<td>$ cut -b 1 info.txt $ cut -b 1-3 info.txt $ cut -b 1,3 info.txt<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>grep<\/td>\r\n<td>Display results of finding expressions in a file<\/td>\r\n<td>$ cat info.txt | grep Desktop $ cat info.txt | grep -i desktop $ grep -i &#8220;desktop&#8221; info.txt<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>sed<\/td>\r\n<td>Perform editing commands, then copy to a standard output<\/td>\r\n<td>First occurance in every line will be changed $ dw&#8217;s\/Desktop\/Dashboard\/&#8217; info.txt 2nd occurance in every line will be changed $ dw &#8216;s\/Desktop\/Dashboard\/2&#8217; info.txt All occurances will be changed $ dw &#8216;s\/Desktop\/Dashboard\/g&#8217; info.txt<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>split<\/td>\r\n<td>Specify a size to break a file into<\/td>\r\n<td>$ split info.txt $ ls $ rm x* -l100 is 100 lines per file $ split -l100 info.txt $ ls<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>sort<\/td>\r\n<td>Arrange the lines in a file<\/td>\r\n<td>$ sort info.txt<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>uniq<\/td>\r\n<td>Keep unique lines in a file and delete duplicates<\/td>\r\n<td>$ echo \u201cHey Hi Hello Commands Linux Irc\u201d &gt; info.txt $ cat info.txt $ uniq info.txt $ uniq info.txt -c $ uniq info.txt -d<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>tar<\/td>\r\n<td>Archive files with one or more directories<\/td>\r\n<td>Archive the file $ tar -cf archive.tar file1 file2 Extract the files $ tar -xf archive.tar<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>cal<\/td>\r\n<td>Show the calendar for the specified month or year<\/td>\r\n<td>$ cal $ cal -3 $ cal -m 5 $ cal -y 2020<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>date<\/td>\r\n<td>Show\/Set the current date and time<\/td>\r\n<td>$ date Sets the system date and time to given date $ date -s &#8220;11\/20\/2003 12:48:00&#8221;<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>bg<\/td>\r\n<td>Run a program or a process in the background<\/td>\r\n<td>$ bg %[PID]<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>free<\/td>\r\n<td>Check for the free memory<\/td>\r\n<td>$free<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>kill<\/td>\r\n<td>Stop a process<\/td>\r\n<td>$ kill &lt;PSID&gt;<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>nice<\/td>\r\n<td>Run a program with a low priority, niceness values range from -20 to 19, with the former being most favorable, while latter being least<\/td>\r\n<td>$ nice -10 ls -R $ nice &#8211;10 ls -R<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>ps<\/td>\r\n<td>Show current running processes<\/td>\r\n<td>$ps<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>top<\/td>\r\n<td>Show list of CPU and memory utilization of processes<\/td>\r\n<td>$top<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>reboot<\/td>\r\n<td>Restart the system<\/td>\r\n<td>$reboot<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>shutdown<\/td>\r\n<td>Turn off system<\/td>\r\n<td>$shutdown<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/figure>\r\n","protected":false},"excerpt":{"rendered":"<p>Commands Description ls To list down all the contents of directory cd To change the directory cd \/bin\/ Change current directory to bin directory cd ~ The tilde (~) sign signifies the user\u2019s home dir \u2013 change dir to home directory cd .. It changes directory one level up mkdir To create a directory pwd<br \/><a class=\"moretag\" href=\"https:\/\/tutorials.darkworld.network\/?p=43\">+ Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":22,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-43","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=\/wp\/v2\/posts\/43","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=43"}],"version-history":[{"count":9,"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":72,"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=\/wp\/v2\/posts\/43\/revisions\/72"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=\/wp\/v2\/media\/22"}],"wp:attachment":[{"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorials.darkworld.network\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}