Basic Red Hat Enterprise Linux 6 commands
Red Hat Enterprise Linux 6 or RHEL 6 is the latest version. The basic commands I mentioned in this article won't vary in previous versions. If you are familiar with Unix or other Linux platforms like Ubuntu it will easier to understand. Everyone can learn this basic commands within a day. To keep all the command in your mind thoroughly you need to work on this command daily. All this command should be entered in the terminal. Let's start our tutorial below.
Copy, paste command
Before learning copy, paste command I first teach you about managing files. Managing files means creating, editing and viewing a file.
Note: Every text after '#' is command.
1. To create an empty file:
Format - #touch
2. To create an empty folder/directory:
Format - #mkdir
To create collaborative directory or more than one directory
Format - #mkdir -p
#mkdir -p /entertainment/songs/video
3. To view the contents in the text file
Format - #cat
4. To edit a text file like notepad in terminal
Format - #vim
If file1 doesn't exist it will be created. To close this notepad press esc key and then colon (:) key, then follow below step.
To quit without saving - q! and press enter
To save the notepad - wq! and press enter
5. To copy a file
Format - #cp
#cp /root/Desktop/file1.txt /var/ftp/pub
6. To copy a folder recursively
Foramat - #cp -rf
7. To move a file
6. To rename a file using move command
7. To delete the empty directory
8. To delete any directory or file
9. To delete any directory or file
10. To view the present working directory
11. List the files/folders in PWD
12. List the hidden files too
13. List the properties of a directory
14. To change the present working directory or open a directory or browse a directory
.. -> indiactes the parent directory
. -> indiactes the current directory
~ -> indicates the home directory of current user
15. To open a known path graphically
Terminal keyboard shortcuts
Using mouse will be annoying while you are working in terminal. This below keyboard shortcuts will be very useful.
Shift+Ctrl+T to open new Tab
Shift+Ctrl+W to close the current Tab
Shift+Ctrl+N to open new Terminal
Shift+Ctrl+Q to close current Terminal
Shift+Ctrl+ + to maximize the window
(Shift plus Ctrl plus '+' symbol)
Ctrl+ - to minimize the window
(Ctrl plus '-' symbol)
Commands for creating users and groups
To create a local user
Ex: #useradd intel
To create a local user
Ex:#useradd -u 1323 intel
To create/change the password for user
To set/change the password that is VISIBLE
Ex:#passwd --stdin intel
To Switch User
Ex:#su - student
To exit the current terminal
To change the User Id of an user
Example:#usermod -u 1450 intel
To display the User ID details of an user
To change the login Shell of an user
'#' for root user prompt
'$' for local user prompt
Root user -> ID 0
system user -> 1 To 499
super user -> > 500
sudo user -> > 500
local user -> > 500
Home directory of root user is /root
Home directory of local users are /home/
Default mail spool for all users should be located in /var/spool/mail/
To delete the created user.
To delete the created user and his/her files.
Example: #userdel -rf intel
To add a new group
#groupadd -g 1567 office
To add an user as secondary member To a group
Example:#usermod -G office staff
To add an user as primary member To a group
Example:#usermod -g office staff10
To change the group ID
Example:#groupmod -g 1445 office
To delete the group
To view the history of the current terminal window.
To clear/delete the history from the terminal.
To shutdown your system.
To restart your system.