BASIC LINUX COMMANDS

Varul Arora
6 min readApr 29, 2020

--

1.mkdir :- mkdir command is used to create an empty directory.

Syntax:- mkdir <folder name>

2. cd: — cd command is used to change the directory.

Syntax: — cd <directory name>

3. top: — top command is used to show all process which is active and sleeping.

Syntax: — top

4. info: — info reads documentation in the info format.

Syntax: — info [option] [menu item]

5. touch:- touch command is used to create an empty file.

Syntax: — touch <file name>

6. rm: — rm command is used to remove the file from the directory.

Syntax: — rm <file name>

7. man: — man command is the interface of the on-line reference manual.

Syntax: — man <command name>

8. rmdir:- rmdir command is used to remove the directory.

Syntax: — rmdir <directory name>

9. apropos: — apropos is used to search the manual page name and description.

Syntax: — apropos <command name>

10. cat:- cat command is used to see and write the contents of the file.

Syntax: — cat >> <file name> <content> (to write)

cat <file name>

11. echo: — echo command is used to display the text.

Syntax: — echo <text to be displayed>

12. ps: — ps command is used to report the snapshot of the current processes.

Syntax: — ps <option>

13. mv: — mv command is used to move 1 file from 1 directory to another.

Syntax: — mv <file name> <directory to be moved>

14. mail: — mail command is used to send an email to the specific mail id with the subject.

Syntax: — mail –s[subject] mailid

After writing the content, press ctrl+d

15. hostname: — hostname command is used to display the hostname of the kernel.

Syntax: — hostname

16. uname: — uname command is used to print the system information.

Syntax: — uname

17. chmod: — chmod command is used to change the permission of files or directories.

Syntax: — chmod u=rwx,g=rx,o=r, demo1.txt

18. umask: — umask command is used to return or set the value of the system file mode.

Syntax: — umask

19. who: — who command is used to display the list of users.

Syntax: — who

20. whoami: — whoami command is used to display the current user logged in.

Syntax: — whoami

21. ls-l: — ls –l command is used to display files and directories in detail.

Syntax: — ls –l

22. ls-a: — ls –a command is used to display hidden files and directories.

Syntax: — ls –a

23. date: — date command is used to display the current date

Syntax: — date

24. cal: — cal command is used to view the calendar.

Syntax: — cal

cal <month> <year>

25. bc: — bc is bash calculator, bc command is used for arithmetic operation.

Syntax: — bc <arithmetic problem>

26. wc: — wc command is used for counting of words in the file.

Syntax: — wc <file name>

27. pipe: — pipe command is used to feed output of one command to another command as an input.

Syntax: — <first command> | <output command>

28. whatis: — whatis command is used to list the usage of command in one line.

Syntax: — whatis <command name>

29. type: — type command is used to display the information of the Linux command whether it is aliased, file, shell built, etc.

Syntax: — type <file name>

30. pwd: — pwd command is used to display the present working directory.

Syntax: — pwd

31. cmp: — cmp command is used to compare two files byte by byte.

Syntax: — cmp <file1> <file2>

32. comm: — comm command is used to compare two sorted files line by line.

Syntax: — cmp <file1> <file2>

33. id: — id command is used to display real and effective user and group id.

Syntax: — id

34. alias: — alias command is used to replace one string with another while execution.

Syntax: — alias string=’command’

unalias: — unalias command is used to remove the function of the alias.

Syntax: — unalias charactername

35. gzip: — gzip command is used to compress the file.

Syntax: — gzip <file name>

gunzip: — gunzip command is used to expand the file.

Syntax: — gunzip <file name>

36. sort: — sort command is used to sort the contents of the file.

Syntax: — sort <file name>

--

--

Varul Arora
Varul Arora

Written by Varul Arora

CTIA | Love cybersecurity, completed MSc in Applied Cyber Security from Queen’s University Belfast. Twitter : @AroraVarul

No responses yet