Monday, 1 July 2013

BASIC COMMANDS IN RED HAT LINUX !!!


1. # poweroff -f

2. # halt -n -p - These commands are used to turn off computer.

3. # init 0

4. # init 6 - These commands are used to Restart computer.

5. # reboot

6. # startx - Switch from command to graphic.

7. # init 5 - Restarts system from command mode to graphic mode.

8. # history - To see history of recent commands.

9. # history -c - To clear the history of recent commands

10. # cat > /etc/issue - To create logoff scripts.

11. # cat > /etc/motd - To create logon scripts.

12. # cal yyyy or mm yyyy - To see the calendar of that month & year.

13. # bc - Starts basic calculator.

14. # whoiam or # w - To know by which user we logged on

15. # adduser <username> - To create user

16. # passwd <username> - To give password to user.

17. # userdel <username> - To delete user.

18. # usermod -L <username> - To lock a user account.

19. # usermod -U <username> - To unlock a user account.

20. # passwd -d <username> - To remove password for a user.

21. # cd ~ - Switch directly to users home directory with.

22. # head <filename> - To see the top ten lines of a file.

23. # head -n 16 <filename> - To see top 16 lines of a file.

24. # tail <filename> - To see the bottom ten lines of a file.

25. # tail -n 16 <filename> - To see bottom 16 lines of a file.

26. # evince <filename.pdf> - To open a pdf file (only on graphical terminal)

27. # sort <filename> - Sort file in a-z format.

28. # sort -d <filename> - Sort file in dictionary format.

29. # sort -r <filename> - Sort file in z-a format.

30. # sort -t : -k 3 –n/r/u <filename>- Sort the file according to given delimiter (n=numeric,

r= decending, u=removes duplication)

11

31. # cat <filename> |tr ‘a-z’ ‘A-Z’ - Translate file in all capital letters.

32. # wc (-l/-w/-c ) <filename> - Word count (-l for line, -w for word, -c for character)

33. # diff file1 file2 - To see difference between same looking files.

34. # blkid - To see device id (ex- hda1, sdb).

35. # mkfs.vfat -I /dev/device id - To format device in fat format.

36. # aspell -c <filename> - To check spelling in a file.

37. # neat - To open network configuration on graphic terminal

38. # ifconfig - To check the IP & MAC address of NIC.

39. # ifconfig eth0 <ip address> - To assign temporary IP

40. # ifup eth0 - To enable network card.

41. # ifdown eth0 - To disable network card.

42. # vi /etc/sysconfig/network-scripts/ifcfg-eth0 To assign permanent IP , here we

43. # vi /etc/sysconfig/networking/devices/ifcfg-eth0 have to edit a file.

44. # ethtool eth0 - To check graphically whether cable is connected or not.

45. # # df -h <partition> - To check the free space of a partition.

46. # ping (-c2, -a) <ip address> - To check connectivity (-c2 for seeing two lines, -a listing)

47. # look <word> - For looking the exact word spelling.

48. # date mmddhhmmyy - To set date.

49. # ps - To check the processing status.

50. # kill -9 PID - To kill the service no. 9.

51. # top - Full details of all processing & their ID. (k- kill, h- help)

52. # wget <website> - To download the website home page.

53. # elinks <website> - To open website in command line.

54. # xterm - Starts a new sub-terminal.

55. # mutt - To send mail in a NIS or single PC between user & root

56. # du -h <partition> - To check how much partition is used.

57. # ln /home/rahul /rahul - It will link the file in home name rahul with rahul (in root)

58. # seq 1 1000 >/home/rag - It will create a file named rag having no. 1 to 1000.

59. # uname - To see kernel name.

60. # uname –r - Kernel release.

61. # uname –a - Whole information about kernel.

62. # find / -name <filename> - Searches file in /.

63. # find -perm 775 - Searches for files having permission 775.

12

64. # find -size ± 512k - Searches for files of 512k

65. # find -name *.htm - Searches files having extension .htm.

66. # zcat <filename.gz> - To see the content of compress file.

67. # chkconfig on/off <service> - To on/off any service permanently.

68. # lsmod - List of drivers running.

69. # modinfo - Details about running driver

70. # sysctl –n kernel - To update kernel.

71. # tmpwatch - Shows temporary files.

72. # getfacl <filename> - It will display full information about that file or directory.

73. # setfacl -m u:<user>:rwx /ww - It will set the full user permission on ww directory.

74. # mount /dev/cdrom /mnt - To mount CD ROM.

75. # mount /dev/device name/mnt- To mount any external device.

76. # mount -t vfat /dev/partition /mnt To mount fat partition.

77. # groupadd <name> - To add a group.

78. # groupdel <name> - To delete group.

79. # groupmod -n <newname> <oldname> - Rename the group.

80. # usermod -G <group> <user> - It will add user to group.

81. # adduser -g <group> <user> - To add network user in group.

82. # cat .bash_history - To see history of commands (after executing history –c)

83. # cat > .bash_history - To remove history of commands

84. # chage -E YYYY-MM-DD <user> - Set user expiration.

85. # chage -l <username> - To see user detailed information.

86. # chage -W 1 <username> - To set warning period for user.

87. # file <file/directory name> - To check whether it is file or folder.

88. # cut –f1 –d : /etc/passwd - It will show the first column of passwd file.

89. # cut -d , 1 file > new file - cuts that line and put it in new file.

90. # paste newfile 2newfile > 3 - paste the data which you have cut from a file in a new file.

91. # finger (-l) - shows the status of the user (-l shows some add. Info)

92. # id username - To see the id of user.

93. # command|tee stages.out - It will give the output of command in file name stages.out.

94. # less <filename> - To see a file pagewise.

95. # grep <word> <filename> - To find a particular word or string in a file.

(-v= didn’t have that word, -c= contain that word)

13

96. # grep –n <word> <filename> - To see the line number in which that word is.

97. # grep -r word <path> - searches word in all files of that location.

(grep= get regular expression)

98. # tar -cvf <name> <filesname> - It will take the backup of files as a single file.

99. # tar -tvf <name> - Show how many files & their name in the backup file.

(-z= gzip, -j=bzip2) (tar = tape archieve)

100. # tar -xvf <name> - Restore the backup.

101. # tar –rvf <name> filename - Append backup with some files.

102. # gzip <filename> - It will compress a file.

103. # bzip2 <filename> - It will compress a file.

104. # gunzip <filename>.gz - It will decompress a file.

105. # gzip -d <filename>.gz - It will decompress a file.

106. # bzip2 -d <filename>.bz2 - It will decompress a file.

107. # bunzip2 <filename>.bz2 - It will decompress a file.

108. # ssh <ip of remote PC> - It will take control of remote pc (ask for password)

109. # scp /root/proxy.exe 10.0.0.1:/root - To send any file in network.

110. #scp -rv <source> <destination> - To send any directory in network.

111. # tunetofs -j /dev/partition - for converting ext2 to ext3

112. # nmap <IP address of PC> - Shows all the port no. opens in that PC

(RPM must be installed)

About the Author

Unknown

Author & Editor

He is a Tech Blogger from last 3 years. He loved to learn new things and technologies. He Interested in making Tech Tutorial’s and Graphic Designing.

Post a Comment

Note: only a member of this blog may post a comment.

 
Computer World With IT © 2015 - Designed by Templateism.com