Resources » Articles/Knowledge Sharing » Education

Basic Red Hat Linux commands and tutorial


Posted Date: 28-Feb-2013  Last Updated:   Category: Education    
Author: Member Level: Gold    Points: 20


Learn basic Red Hat commands from this article. I have covered all the basic commands to work in Red Hat Enterprise Linux 6. You can learn this basic Red Hat Linux commands for interview preparation too.



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
#touch file1.txt

2. To create an empty folder/directory:
Format - #mkdir
#mkdir /texus

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
#cat file1.txt

4. To edit a text file like notepad in terminal
Format - #vim
#vim file1.txt
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
#mv

6. To rename a file using move command
#mv

7. To delete the empty directory
#rmdir

8. To delete any directory or file
#rmdir

9. To delete any directory or file
#rm -rf

10. To view the present working directory
#pwd

11. List the files/folders in PWD
#ls

12. List the hidden files too
#ls -a

13. List the properties of a directory
#ls -ld (or)
#ls -l

14. To change the present working directory or open a directory or browse a directory
#cd
#cd /var/lib/libvirt/
#cd ..

.. -> indiactes the parent directory
. -> indiactes the current directory
~ -> indicates the home directory of current user

15. To open a known path graphically
#nautilus
#nautilus /var/ftp/pub/

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



#useradd
To create a local user
Ex: #useradd intel

#useradd -u
To create a local user
Ex:#useradd -u 1323 intel

#passwd
To create/change the password for user
Ex:#passwd intel


#passwd --stdin
To set/change the password that is VISIBLE
Ex:#passwd --stdin intel

#su -
To Switch User
Ex:#su - student

$logout
(or) Ctrl+D
To logout

$exit
To exit the current terminal

#usermod -u
To change the User Id of an user
Example:#usermod -u 1450 intel

#id
To display the User ID details of an user
Example:#id intel

#chsh
To change the login Shell of an user
Example:#chsh intel

'#' 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

Note:
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/

#userdel
To delete the created user.
Example:#userdel intel

#userdel -rf
To delete the created user and his/her files.
Example: #userdel -rf intel

#groupadd office
To add a new group

#groupadd -g 1567 office

#usermod -G
To add an user as secondary member To a group
Example:#usermod -G office staff

#usermod -g
To add an user as primary member To a group
Example:#usermod -g office staff10

#groupmod -g
To change the group ID
Example:#groupmod -g 1445 office

#groupdel
To delete the group

#history
To view the history of the current terminal window.

#history -c
To clear/delete the history from the terminal.

#halt
To shutdown your system.

#reboot
To restart your system.
Related Resources:


Read related articles: Red Hat Linux    Linux Basics    Linux Tutorial    Linux Command    Linux    

Did you like this resource? Share it with your friends and show your love!




Responses to "Basic Red Hat Linux commands and tutorial"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Awards & Gifts
    Active Members
    TodayLast 7 Daysmore...

    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.