Linux Basic Commands Part2
Following commands are used to turn off computer.
01. # poweroff -f
02. # halt -n -p
03. # init 0
Following commands are used to Restart computer.
04. # init 6
05. # reboot
06. # startx Switch from command to graphic.
07. # init 5 Restarts system from command mode to graphic mode.
08. # history To see history of recent commands.
09. # history -c To clear the history of recent commands
10. # cat > /etc/issue To create logoff scripts.
11. # cat > /etc/motd To create logon message.
12. # cal 06 2013 To see the calendar of that month(jun) & year(2013).
13. # bc Starts basic calculator.
14. # whoami To know logged user name
15. # adduser username To create user
16. # passwd username To give password to user.
17. # usermod -L username To lock a user account.
18. # usermod -U username To unlock a user account.
19. # passwd -d username To remove password for a user.
20. # cd Switch directly to users home directory with.
21. # head filename To see the top ten lines of a file.
22. # head -n 18 filename To see top 18 lines of a file.
23. # tail filename To see the bottom ten lines of a file.
24. # tail -n 12 filename To see bottom 12 lines of a file.
25. # sort filename Short file in a-z format.
26. # sort -d filename Short file in dicbonary format.
27. # sort -r filename Short file in reverse format.
28. # cat filename |tr ‘a-z’ ‘A-Z’ Translate all small letters in capital letters within given file.
29. # wc filename Word count (line, word, character)
30. # diff file1 file2 To see difference between same looking files.
31. # blkid To see devices (e.g. sda, sdb).
32. # aspell -c filename To check spelling in a file.
33. # ifconfig To check the IP & MAC address of NIC.
34. # ifconfig eth0 ip address To assign temporary IP
35. # ifup eth0 To enable network card.
36. # ifdown eth0 To disable network card.
37. # vi /etc/sysconfig/network-scripts/ifcfg-eth0 To assign permanent IP with file editing.
38. # ethtool eth0 To check whether cable is connected or not.
39. # df -h directory To check the free space of a partition
40. # date mmddhhmmyy To set date.
41. # ps To check the processing status.
42. # kill PID To kill the service with given pid
43. # top Full details of all processing & their ID. (k- kill, h- help)
44. # wget website To open website home page.
45. # elinks website To open website in command line
46. # xterm Starts a new sub-terminal.
47. # du -h partition To check how much parbbon is used.
48. # ln /home/kamal /kamal It will link the file in home name rahul with rahul (in root)
49. # seq 1 150 >/home/dixit It will create a file named rag having no. 1 to 150.
50. # uname To see kernel name.
51. # uname –r Kernel release.
52. # uname –a Whole information about kernel.
53. # find / -name filename Searches file.
54. # find -perm 775 Searches for files having permission 775.
55. # find -name *.htm Searches files having extension .htm.
56. # zcat filename.gz To see the content of compress file.
57. # chkconfig service on/off To on/off any service permanently.
58. # lsmod List of drivers running.
59. # modinfo Details about running driver
60. # sysctl –n kernel To update kernel.(do'nt use if u are new about linux)
61. # tmpwatch Shows temporary files.
62. # getfacl filename It will display full information about that file or directory.
63. # setfacl -m u:user:rwx ww It will set the full user permission on ww directory.
64. # mount /dev/cdrom /mnt To mount CD ROM.
65. # mount /dev/devicename /mnt To mount any external device.
66. # mount -t vfat /dev/partition /mnt To mount fat partition.
67. # userdel username To delete user.
68. # groupadd name To add a group.
69. # groupdel name To delete group.
70. # cat .bash_history To see history of commands (after executing history –c)
71. # chage -E YYYY-MM-DD username Set user expiration.
72. # chage -l username To see user detailed information.
73. # file file/directory name To check whether it is file or folder.
74. # cut –f1 –d : /etc/passwd It will show the first column of passwd file.
75. # usermod -G group user It will add user to group.
76. # id username To see the id of user.
77. # less filename To see a long file pagewise.
78. # grep word filename To find a particular word or string in a file.
79. # grep –n word filename To see the line number in which that word is.
80. # tar -cvf name filesname It will take the backup of files as a single file.
81. # tar -tvf name Show how many files & their name in the backup file.
82. # tar -xvf name Restore the backup.
01. # poweroff -f
02. # halt -n -p
03. # init 0
Following commands are used to Restart computer.
04. # init 6
05. # reboot
06. # startx Switch from command to graphic.
07. # init 5 Restarts system from command mode to graphic mode.
08. # history To see history of recent commands.
09. # history -c To clear the history of recent commands
10. # cat > /etc/issue To create logoff scripts.
11. # cat > /etc/motd To create logon message.
12. # cal 06 2013 To see the calendar of that month(jun) & year(2013).
13. # bc Starts basic calculator.
14. # whoami To know logged user name
15. # adduser username To create user
16. # passwd username To give password to user.
17. # usermod -L username To lock a user account.
18. # usermod -U username To unlock a user account.
19. # passwd -d username To remove password for a user.
20. # cd Switch directly to users home directory with.
21. # head filename To see the top ten lines of a file.
22. # head -n 18 filename To see top 18 lines of a file.
23. # tail filename To see the bottom ten lines of a file.
24. # tail -n 12 filename To see bottom 12 lines of a file.
25. # sort filename Short file in a-z format.
26. # sort -d filename Short file in dicbonary format.
27. # sort -r filename Short file in reverse format.
28. # cat filename |tr ‘a-z’ ‘A-Z’ Translate all small letters in capital letters within given file.
29. # wc filename Word count (line, word, character)
30. # diff file1 file2 To see difference between same looking files.
31. # blkid To see devices (e.g. sda, sdb).
32. # aspell -c filename To check spelling in a file.
33. # ifconfig To check the IP & MAC address of NIC.
34. # ifconfig eth0 ip address To assign temporary IP
35. # ifup eth0 To enable network card.
36. # ifdown eth0 To disable network card.
37. # vi /etc/sysconfig/network-scripts/ifcfg-eth0 To assign permanent IP with file editing.
38. # ethtool eth0 To check whether cable is connected or not.
39. # df -h directory To check the free space of a partition
40. # date mmddhhmmyy To set date.
41. # ps To check the processing status.
42. # kill PID To kill the service with given pid
43. # top Full details of all processing & their ID. (k- kill, h- help)
44. # wget website To open website home page.
45. # elinks website To open website in command line
46. # xterm Starts a new sub-terminal.
47. # du -h partition To check how much parbbon is used.
48. # ln /home/kamal /kamal It will link the file in home name rahul with rahul (in root)
49. # seq 1 150 >/home/dixit It will create a file named rag having no. 1 to 150.
50. # uname To see kernel name.
51. # uname –r Kernel release.
52. # uname –a Whole information about kernel.
53. # find / -name filename Searches file.
54. # find -perm 775 Searches for files having permission 775.
55. # find -name *.htm Searches files having extension .htm.
56. # zcat filename.gz To see the content of compress file.
57. # chkconfig service on/off To on/off any service permanently.
58. # lsmod List of drivers running.
59. # modinfo Details about running driver
60. # sysctl –n kernel To update kernel.(do'nt use if u are new about linux)
61. # tmpwatch Shows temporary files.
62. # getfacl filename It will display full information about that file or directory.
63. # setfacl -m u:user:rwx ww It will set the full user permission on ww directory.
64. # mount /dev/cdrom /mnt To mount CD ROM.
65. # mount /dev/devicename /mnt To mount any external device.
66. # mount -t vfat /dev/partition /mnt To mount fat partition.
67. # userdel username To delete user.
68. # groupadd name To add a group.
69. # groupdel name To delete group.
70. # cat .bash_history To see history of commands (after executing history –c)
71. # chage -E YYYY-MM-DD username Set user expiration.
72. # chage -l username To see user detailed information.
73. # file file/directory name To check whether it is file or folder.
74. # cut –f1 –d : /etc/passwd It will show the first column of passwd file.
75. # usermod -G group user It will add user to group.
76. # id username To see the id of user.
77. # less filename To see a long file pagewise.
78. # grep word filename To find a particular word or string in a file.
79. # grep –n word filename To see the line number in which that word is.
80. # tar -cvf name filesname It will take the backup of files as a single file.
81. # tar -tvf name Show how many files & their name in the backup file.
82. # tar -xvf name Restore the backup.
No comments:
Post a Comment