0% found this document useful (0 votes)
30 views

LSP Commands 1

Linux programming research paper

Uploaded by

23cse077
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
30 views

LSP Commands 1

Linux programming research paper

Uploaded by

23cse077
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 30
Linux Commands with Examples The Linux command is a utility of the Linux operating system. All basic and advanced tasks can be done by executing commands. The commands are executed on the Linux terminal. The terminal is a command-line interface to interact with the system, which is similar to the command prompt in the Windows OS. Commands in Linux are case-sensitive. Linux terminal is a user-friendly terminal as it provides various support options. To open the Linux terminal, press "CTRL + ALT + T" keys together, and execute a command by pressing the 'ENTER' key, Linux Directory Commands 1. pwd Command The pwd command is used to display the location of the current working directory. Syntax: pwd Output: To UGE e hah (Deueyaexeesuss 2. mkdir Command The mkdir command is used to create a new directory under any directory. Syntax: mkdir 3. rmdir Command The rmdir command is used to delete a directory. Syntax: tmdir uo r cea ener in mm esi] javatpoint@javatpoint-Inspiron-3542 4. 1s Command The Is command is used to display a list of content of a directory. Syntax: Is ries ory aS 5 pe eee aa) Akash race la out 0 ates Eee cs ints foe " ciety oeeers core rae ceed 5. ed Command The cd command is used to change the current directory. Syntax: ed Output: Linux File commands 6. touch Command The touch command is used to create empty files. We can create multiple empty files by executing it once. Syntax . touch . touch .... Output: Perens ss 7. cat Command The cat command is a multi-purpose utility in the Linux system. It can be used to create a file, display content of the file, copy the content of one file to another file, and more. Syntax: cat [OPTION]... [FILE]. To create a file, execute it as follows . cat > // Enter file content Press "CTRL+ D" keys to save the file. file, execute it as follows: cat FESO ese This is @ text file Pere ns Fee et eee Wem Cece 8. rm Command The rm command is used to remove a file. Syntax: rm Output: GEE Er kas 9. cp Command The op ‘0 display the content of the ee eo word acu ea rn a eee command is used to copy a file or directory. Syntax: To copy in the same directory: cp rent directory: es cores javatpoint@javatpoint-Inspiron-3542:~$ cp demo.txt Documents 10. my Command The my command is used to move a file or a directory form one location to another location. Syntax: mv Output: Bech on Cars rainy 11. rename Command The rename command is used to rename file group of files. It is useful for renaming a large Syntax: rename 's/old-name/new-name'' files For example, to convert all the text files into pdf files, execute the below command: rename 's/\.txt$/\.pdf/" *.txt Output: PEEiane east ce PDE Sera Tac ac - eC ac ace ace acy Linux File Content Commands 12. head Command The head command is used to display the content of a file. It displays the first 10 lines of a file. Syntax: head Output: Pea p cect trier rem rt carers 13. tail Command The tail command is similar to the head command. The difference between both commands is that it displays the last ten lines of the file content. It is useful for reading the error message. Syntax: tail 14, tac Command The tac command is the reverse of cat command, as its name specified. It displays the file content in reverse order (from the last line). Syntax: tac Output: javatpoint@javatpoint-Inspiron-3542:~$ tac Demo. txt 15. more command The more command is quite similar to the cat command, as it is used to display the file content in the same way that the cat command does. The only difference between both commands is that, in case of larger files, the more command displays screenful output at a time. In more command, the following keys are used to scroll the page: ENTER key: To scroll down page by line. Space bar: To move to the next page. b key: To move to the previous page. / key: To search the string. Syntax: more Output: FPR en ee en oe Copyright (c) 2012 Google Inc. All rights reserved RES eee cea Nn Rees Mee a found tn the LICENSE file. ree eee aCe Tee) (require ‘gyp) (Gee NS) (require ‘cl) CN Gem Reo Sa ears OL OS Le LT Og rca Cee Te ME ee ee eT Le Dee eres ee Cee ee Ce rer a BP Sheet a DD) (defadvice python-indent-calculate-levels (after gyp-outdent-closing-parens activate) Pree aS Dee Le Ce Cen CUCU CCRC SL Can Nee) (string-match "* *[])}][],)}]* *$" Clie et ite Ene Laat ~-Nore-- (7%) 16. less Command The les command is similar to the more command. It also includes some extra features such as ‘adjustment in width and height of the terminal." Comparatively, the more command cuts the output in the width of the terminal. Syntax: less Output: PA Seen sie ee acon I; Copyright (c) 2012 Google Inc. All rights reserved Pere eee en Se en ea ccna Pati is eco oa ae Pee eee Cee LT (require 'ayp) etre) (require ‘cl) CRG e Or se ree eT a) ee CM gE Coat DD Cmca he a ae CC ee Lee ee Crh a "python-mode.el"))) (defadvice python-indent-calculate-levels (after gyp-outdent-closing-paren: activate) Linux User Commands 17. su Command The su command provides administrative access to another user. In other words, it allows access of the Linux shell to another user. Syntax: su Berets att ernie ee wet ters rats Password: javatpoint@javatpoint-Inspiron-3542:~$ ff 18. id Command The id command is used to display the user ID (UID) and group ID (GID). Syntax: id Output: javatpoint@javatpoint-Inspiron-3542:~$ id Tet G rt some ees G Ee SM Tea esl G reat a eee UD ELCs WDPPAAeT PECL DRC GLP PECL GND Eee CSIC javatpoint@javatpoint-Inspiron-3542:~$ ff 19. useradd Command The useradd command is used to add or remove a user on a Linux server. Syntax: useradd username Output: Pets biuse ct tree ter tenet mime Ren [sudo] password for javatpoint: PE MCh arc Leela 20. passwd Command The passwd command is used to create and change the password for a user. Syntax: passwd Output: javatpoint@javatpoint-Inspiron-3542:~$ sudo passwd JTP iene Pear cern ia) Retype new UNIX password: CEE Ee eee scene 21. groupadd Command The groupadd command is used to create a user group. Syntax: groupadd PCE any t@javatp Linux Filter Commands 22. cat Command The cat command is also used as a filter. To filter a file, it is used inside pipes. Syntax: cat | cat or tac | cat or tac |... Output: javatpoint@javatpoint-Inspiron-3542:~$ cat Demo.txt | tac | cat | cat | tac 23. cut Command The cut command is used to select a specific column of a file. The '-d' option is used as a delimiter, and it can be a space (''), a slash (/), a hyphen (- ), or anything else. And, the '-f option is used to specify a column number. Syntax: cut -d(delimiter) -f(columnNumber) rae rie ces -f2 marks. txt 24. grep Command The grep is the most powerful and used filter in a Linux system. The 'grep' stands for "global regular expression print." It is useful for searching the content from a file. Generally, it is used with the pipe. Syntax: command | grep Ete sce perunerr rs 25. comm Command The ‘comm! 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. Syntax comm Output: Pera t at eae rer eeert eto eeaes Cee ee 26. sed command The sed command is also known as stream editor. It is used to edit files using a regular expression. It does not permanently edit files; instead, the edited content remains only on display. It does not affect the actual file. Syntax: command | sed 's///" Output: Feces bis near tuner he ws eran me acne yg) Bnd REET CCE sor ere eee a eae et I CY BEES 27. tee command The tee command is quite similar to the cat command. The only difference between both filters is that it puts standard input on standard output and also write them into a file. Syntax: cat | tee | cat or tac Output: javatpoint@javatpoint-Inspiron-3542:~$ cat marks.txt | tee new.txt | cat penser) 28. tr Command The tr command is used to translate the file content like from lower case to upper case. Syntax: command | tr <'old'> <'new'> Output: cen cece errr ree rn eeeat se em ee Co al eacureey WUE) 29. uniq Command The uniq command is used to form a sorted list in which every word will occur only once. Syntax: command | uniq Output: javatpoint@javatpoint-Inspiron-3542:~$ sort marks.txt |uniq 30. we Command The command is used to count the lines, words, and characters in a file. Syntax: we Output: PEO rin sue cn reece anc irs Pyar ets 31. od Command The od command is used to display the content of a file in different s, such as hexadecimal, octal, and ASCII characters. Synta: od -b —_// Octal format od -t x1 // Hexa decimal format od -c —// ASCII character format Output: javatpoint@javatpotnt-Inspiron-3542:~$ od -b marks. txt COR BC e Me re eC eet eee) aC Omred lo0e0020 152 157 156 055 06 Cobar reer rect eC aeeee OMe Ees pees 055 071 060 612 152 165 pee Er red javatpoint@javatpoint-Inspiron-3542:~$ od -t x1 marks. t: looco000 61 CeO eet Lae) Heer Peer ec eI ee ee eC a cae! Peeeromer) CE loocoo64 FEN CEM heater Cee ey Cae en) an fn L e 32. sort Command The sort command is used to sort files in alphabetical order. Syntax: . sort Output: econ ut mere eas mes justin-80 33. gzip Command The gzip command is used to truncate the file size. It is a compressing tool. It replaces the original file by the compressed file having '.gz' extension. Syntax: . gzip ... Output: javatpoint@javatpoint-Inspiron-3542:~$ gzip Deno.txt Denol. txt FCC Eiht tater eee cd ecu raat reac hello.o i 3 rater icra i tal J id 34. gunzip Command The gunzip command is used to decompress a file. It is a reverse operation of gzip command. Syntax: . gunzip . . javatpoint-Inspiron-3542:~$ gunzip Demo.txt Demo1.txt Be Citas Oe Seber Demme Pra esas Cole is c eae Cert a hello.s Di Tia e.da a ee PLB) ei ee ee peaemes cli crams Linux Utility Commands 35. find Command The find command is used to find a particular file within a directory. It also supports various options to find a file such as byname, by type, by date, and more. The following symbols are used after the find command: (.): For current directory name (/) : For root Syntax: . find . name "*.pdf" Output: javatpoint@javatpoint-Inspiron-3542:~$ find . -name "*.pdf" |. /Test.pdf Wire eCHO ae Ag Aaa Ce eee Ee Ce STL ec te ee eee Le Wee Peet CL mee Peet eerie a WEE Ate ARM EL eerie egret ELEC LEC Le WARM e Aare Peer recreate ee Cer Oe Find: ‘./.anydesk/incoming’: Permission denied - /Downloads/ConfirmationPage_20030070774. pdf Weeurert ts se ae) Lethe CL d ea ae ee a) Witte sg aon ie Wie eee Witter ecu tie 36. locate Command The locate command is used to search a file by file name. It is quite similar to find command; the difference is that it is a background process. It searches the file in the database, whereas the find command searches in the file system. It is faster than the find command. To find the file with the locates command, keep your database updated. Syntax: . locate Output: Ber uo necro erie ramen esas tg protease Ra aa Ee asec s exo hnySasee tg (BEE fa eases /snap/core/8935/etc/sysctl.d/99-sysctl.conf ER Eas Radeon RE Eat Ee ee icra eed ate ee ad ees snap/core18/1754/etc/sysctl.d/99-sysctl. conf |/usr/share/doc/procps/examples/sysctl.conf (Eg Eure LEW Gury ead eer 37. date Command The date command is used to display date, time, time zone, and more. Synta . date Output: 38. cal Command The cal command is used to display the current month's calendar with the current date highlighted. Syntax: - cal< Output: Javatpoint@javatpoint-Inspiron-3542:~$ cal TEV aee} oa 34567 FOReare ares 47 18 19 20 LeeLee 31 39. sleep Command The sleep command is used to hold the terminal by the specified amount of time. By default, it takes time in seconds. Syntax: . sleep

You might also like