Basic Red Hat Linux commands and tutorial

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

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
#rm -rf

10. To view the present working directory

11. List the files/folders in PWD

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

To create a local user
Ex: #useradd intel

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

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

(or) Ctrl+D
To logout

To exit the current terminal

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

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

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

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.
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

To delete the group

To view the history of the current terminal window.

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

To shutdown your system.

To restart your system.

Related Articles

Permissions in Linux Operating System

This article will explains the permissions present in Linux operating system. Permissions means how an operating system give access to many users on single system with complete security. We can use many permissions command in Linux but here i will explain important ones.

Regular Expression of Linux

This article will help you in learning of regular expressions of Linux. Regular expressions are use for matching a pattern in a text or in a file. Regular expressions are little bit similar to sorting of a text. We will use grep command in all type of regular expressions in Linux.

IT Pre-recruitment Training Ladies Exclusive Batch in Thrissur

CMS Infosystems Pvt Ltd invites application for pre-recruitment training for IT Infrastructure support jobs from 2013 pass out female candidates in Thrissur. Candidates with any degree or diploma, including professional degree like B.Tech or BCA can apply. Training in CCNA, MCSA,linux - RHCE, Cloud, Security, Ethical hacking are included. CMS Placement cell assures placements for all candidates who complete CCNS certification.

More articles: Linux Command Linux


No responses found. Be the first to 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: