{"id":74,"date":"2025-02-11T04:30:35","date_gmt":"2025-02-11T04:30:35","guid":{"rendered":"https:\/\/mitalgoswami.in\/?page_id=74"},"modified":"2025-02-11T04:30:35","modified_gmt":"2025-02-11T04:30:35","slug":"how-to-perform-command","status":"publish","type":"page","link":"https:\/\/mitalgoswami.in\/?page_id=74","title":{"rendered":"How to perform command"},"content":{"rendered":"\n<p>1)Find command:-<\/p>\n\n\n\n<p>find . -name a.txt<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Find Read-Only Files<\/h1>\n\n\n\n<p>find \/ -perm \/u=r<\/p>\n\n\n\n<p>find sss -name c.txt<\/p>\n\n\n\n<p>find -type d -name sss<\/p>\n\n\n\n<p>find ~ -name &#8220;a.txt&#8221;<\/p>\n\n\n\n<p>#Find all Empty Directories<br>find \/tmp -type d -empty<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">. File all Hidden Files<\/h1>\n\n\n\n<p>find \/tmp -type f -name &#8220;.*&#8221;<\/p>\n\n\n\n<p>find \/ -size 50M<\/p>\n\n\n\n<p>2)pg Command:-<\/p>\n\n\n\n<p>pg a.txt<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">clear screen<\/h1>\n\n\n\n<p>pg -c a.txt<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">do not display &#8220;EOF&#8221;<\/h1>\n\n\n\n<p>pg -e a.txt<\/p>\n\n\n\n<p>3)more command :-<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">overlaping and clearing window not scrolling<\/h1>\n\n\n\n<p>more -c a.txt<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">display &#8220;Press space to continue &#8220;q&#8221; to quit<\/h1>\n\n\n\n<p>more -d a.txt<\/p>\n\n\n\n<p>cat a.txt | more<br>ls | more<\/p>\n\n\n\n<p>4)less command:-(allow scrolling)<br>Ctrl + f : forwards one window<br>Ctrl + d : forwards half window<br>Ctrl + b : backwards one window<br>Ctrl + u : backwards half window<br>j : forward by one line<br>k : backward by one line<\/p>\n\n\n\n<p>less a.txt<\/p>\n\n\n\n<p>5)head command:-<\/p>\n\n\n\n<p>head -5 a.txt<\/p>\n\n\n\n<p>6)tail command:-<br>tail -5 a.txt<\/p>\n\n\n\n<p>7)wc command :-<br>wc -l a.txt<br>wc -c a.txt<br>wc -w a.txt<\/p>\n\n\n\n<p>8)touch command<br>-a:-This option changes the access time only<br>-m:-This option changes the modification time only.<br>-r:-Uses the access and modification times from the reference file.<\/p>\n\n\n\n<p>touch a<br>touch b<br>stat a<br>touch -m a b<br>stat a<\/p>\n\n\n\n<p>touch -r a.txt b.txt<br>touch m.txt a.txt -m<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">set the time of m replace a<\/h1>\n\n\n\n<p>touch -c -d &#8220;16 sep&#8221; doc2<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">This is used to update access[-c] and modification[-d: date string] time<\/h1>\n\n\n\n<p>touch -d &#8220;2 hours ago&#8221; filename<br>touch test{1..10}<\/p>\n\n\n\n<p>=)regular expression searching command<br>1)grep command:-(global regular expression print)<\/p>\n\n\n\n<p>grep &#8220;m&#8221; a.txt<br>grep &#8220;M&#8221; a.txt<br>grep -i &#8220;M&#8221; a.txt #case insensitive<br>grep -c &#8220;M&#8221; a.txt #line count<br>grep -n &#8220;M&#8221; a.txt #line number<br>grep -w &#8220;MM&#8221; a.txt # word<\/p>\n\n\n\n<p>grep -f a.txt b.txt #mathching of two file<br>grep -L &#8220;unix&#8221; * #file names that matches &amp; pattern<\/p>\n\n\n\n<p>2)fgrep command:-fixed-character strings in a file<br>fgrep &#8220;mm&#8221; a.txt<br>fgrep -c &#8220;m&#8221; a.txt #line number<br>fgrep &#8220;m&#8221; *.txt<br>fgrep -l &#8220;@a&#8221; a.txt #print filename<br>fgrep -n &#8220;@a&#8221; a.txt #print line number<br>fgrep -x &#8220;a&#8221; a.txt #display only lines matched entirely.<\/p>\n\n\n\n<p>3)egrep command:-<br>egrep &#8220;mital&#8221; * #globally search<br>egrep &#8220;m&#8221; a.txt<br>egrep -c &#8220;mm&#8221; a.txt #linenumber mathched<br>egrep -l &#8220;mm&#8221; a.txt # print filename<br>egrep -n &#8220;mm&#8221; a.txt # print linenumber<br>egrep -r &#8220;m<em>&#8221; m.txt egrep -r &#8220;m<\/em>&#8221; . #recursively searching whole root<\/p>\n\n\n\n<p>=&gt;working with columns and fields<br>1)cut:-<br>cat &gt; stat.txt<br>Andhra Pradesh<br>Arunachal Pradesh<br>Assam<br>Bihar<br>Chhattisgarh<br>ctrl+z<\/p>\n\n\n\n<p>cut -b 1,2,3 stat.txt<br>cut -b -3 stat.txt<br>cut -c 2,3 stat.txt<\/p>\n\n\n\n<p>cat &gt; b.txt<br>01234:567;89<br>abcd:drg;ij<br>ctrl+z<\/p>\n\n\n\n<p>cut -d &#8220;;&#8221; -f1 b.txt \/\/-f column name<br>cut -d &#8220;:&#8221; -f2 b.txt<br>who | cut -c 1-2<\/p>\n\n\n\n<p>2)paste:-<br>paste a.txt b.txt<br>paste -d &#8220;%&#8221; a.txt b.txt<br>paste -d &#8220;1,&#8221; a.txt b.txt c.txt<br>cat stat.txt | paste<\/p>\n\n\n\n<p>3)join:-<br>cat &gt; a.txt<br>1 aaa<br>2 vvv<br>^Z<br>cat &gt; b.txt<br>1 xxx<br>2 ccc<br>^Z<br>join a.txt b.txt<br>join a.txt b.txt &gt; l.txt<\/p>\n\n\n\n<p>=&gt;<br>1)sort command:-<br>sort -r a.txt #reverse<br>sort -n a.txt #numerical character<br>sort -u a.txt # duplicate remove display<br>sort -c a.txt #if already sorted no output<br>sort -k2 a.txt #particular column<br>sort -m a.txt # sort monthwise<\/p>\n\n\n\n<p>2)unique command:-<br>cat &gt; music<br>i love music<br>i love music<br>i love music<\/p>\n\n\n\n<p>3)uniq music<br>uniq -u music #unique line<br>uniq -d music #duplicate line<br>uniq -c music # count<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">redirection and piping<\/h1>\n\n\n\n<p>ls &#8211; l &gt;hello #output(stdout)<br>cat &gt;&gt; out.txt #append data<br>cat &gt;&gt; out.txt &lt; l.txt # input data (stdin)<br>cat file.txt | grep &#8220;mm&#8221; a.txt<br>cat m.txt | more<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">comparing file<\/h1>\n\n\n\n<p>cat &gt; a<br>This is a Line1<br>^z<br>cat &gt; b<br>This is a Line2<br>^z<\/p>\n\n\n\n<p>1)cmp:-<br>cmp a b #byte<\/p>\n\n\n\n<p>2)comm:-&#8216;comm&#8217; command is used to compare two files or streams. By default, it displays three columns, first displays non-matching items of the first file, second indicates the non-matching item of the second file, and the third column displays the matching items of both files.<\/p>\n\n\n\n<p>comm a b #linebyline<\/p>\n\n\n\n<p>3)diff:-<br>diff a b # &gt;line &lt; line<\/p>\n\n\n\n<p>=&gt;changing information to file<br>1)tr[translate)<\/p>\n\n\n\n<p>cat file | tr [a-z] [A-Z]<br>at b.txt | tr &#8216;hello&#8217; &#8216;HELLo&#8217;<br>cat file | tr [:lower:] [:upper:]<br>echo &#8220;Welcome To Geetanjali&#8221; | tr [:space:] &#8220;\\t&#8221;<br>tr -d W &lt;&lt;&lt; &#8220;Welcome to Geetanjali&#8221; #remove &#8220;W&#8221;<br>echo &#8220;my ID is 73535&#8221; | tr -d [:digit:] #remove digit<br>echo &#8220;my ID is 73535&#8221; | tr -cd [:digit:] #complete digit<br>echo &#8220;hello world&#8221; | tr -d &#8216; &#8216;<br>echo -e &#8220;hello\\nworld&#8221; | tr -d &#8216;\\n&#8217;<\/p>\n\n\n\n<p>2)sed (stream editor programme)<\/p>\n\n\n\n<p>cat &gt; a.txt<br>unix is great os. unix is opensource. unix is free os.<br>learn operating system.<br>unix linux which one you choose.<br>unix is easy to learn.unix is a multiuser os.Learn unix .unix is a powerful.<br>^z<\/p>\n\n\n\n<p>sed &#8216;s\/unix\/linux\/&#8217; a.txt<br>sed &#8216;s\/unix\/linux\/2&#8217; a.txt #change 2 line<br>sed &#8216;s\/unix\/linux\/g&#8217; a.txt #globally replacement<\/p>\n\n\n\n<p>3)od:-<br>od -b a.txt #convert file in octal format<br>od -c a.txt #convert character format<\/p>\n\n\n\n<p>MATHEMATICAL CALCULATION<\/p>\n\n\n\n<p>BC command:-<\/p>\n\n\n\n<p>x=10<br>y=20<br>echo $x+$y | bc<\/p>\n\n\n\n<p>factor command:-<\/p>\n\n\n\n<p>factor 10<\/p>\n\n\n\n<p>MONITORING INPUT OUTPUT<\/p>\n\n\n\n<p>tee command:-<br>cat &gt; a<br>1<br>2<br>3<br>cat &gt;b<br>4<br>5<br>6<br>wc -l a |tee -a b<\/p>\n\n\n\n<p>who | tee a.txt # content remove and data<br>who | tee -a a.txt #add existing file<\/p>\n\n\n\n<p>script command:-(record all the terminal activities)<br>script a<br>date<br>time<br>cal<br>exit<br>cat a<\/p>\n\n\n\n<p>DATE &amp; TIME RELATED COMMAND<\/p>\n\n\n\n<p>cal<br>cal 2022<\/p>\n\n\n\n<p>date +\u201c%A\u201d #display weekday<br>display date in mm\/dd\/yy<br>date +\u201c%D\u201d<\/p>\n\n\n\n<p>COMMUNICATION COMMAND<\/p>\n\n\n\n<p>wall l.txt #write a message to all users<br>wall Submit Your UNIX Assignment Tomorrow.<\/p>\n\n\n\n<p>write stud #send message on users<\/p>\n\n\n\n<p>mail -s &#8220;hello world&#8221; some@gmail.com<\/p>\n\n\n\n<p>finger mital #show information of users<\/p>\n\n\n\n<p>mesg #control write access to your terminal<br>mesg [y\/n]<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">The ping command sends an echo request to a host available on the network.<\/h1>\n\n\n\n<p>ping www.google.com<br>ping 216.58.203.4<br>ping localhost<\/p>\n\n\n\n<p>PROCESS RELATED COMMANDS<br>ps #display about active process<br>ps -f #full display<br>ps -u mital #specific user<\/p>\n\n\n\n<p>nice #set the priority of the process<br>nice -10 gnome-terminal<\/p>\n\n\n\n<p>kill #located in (\/bin\/kill)<br>kill -l #to display all available signal<br>kill 1024<\/p>\n\n\n\n<p>at 12:15 #to schedules a command to be run once at a particular time.<br>at tuesday +2 hours<\/p>\n\n\n\n<p>crontab -l #view logged in current user enteries in crontab<\/p>\n\n\n\n<p>sleep 10s<br>sleep 1m<\/p>\n\n\n\n<p>S= for second (the default)<br>m=for minutes.<br>h= for hours.<br>d= for days.<br>EXAMPLE:<br>\uf0d8<br>Create file \u2018test.sh\u2019 and run with <code>sh<\/code><br>echo \u201cdisplay Message After 10Second\u201d<br>sleep 10<br>echo \u201cWelcome\u201d<\/p>\n\n\n\n<p>wait<\/p>\n\n\n\n<p>top #active linux Processes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1)Find command:- find . -name a.txt Find Read-Only Files find \/ -perm \/u=r find sss -name c.txt find -type d -name sss find ~ -name &#8220;a.txt&#8221; #Find all Empty Directoriesfind \/tmp -type d -empty . File all Hidden Files find \/tmp -type f -name &#8220;.*&#8221; find \/ -size 50M 2)pg Command:- pg a.txt clear screen [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-74","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/pages\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=74"}],"version-history":[{"count":1,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/pages\/74\/revisions"}],"predecessor-version":[{"id":76,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/pages\/74\/revisions\/76"}],"wp:attachment":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}