On my previous article we discussed in detail on how to configure and Install RedHat/CentOS 7 Linux. I always suggest you try to install CentOS core because Red Hat Linux is mainly used for server platform.
So, if you use CentOS Desktop, your server will be bulky as well as server overhead will increase. It may in most cases slow down your server performance. On the other hand, Linux always like to play with command rather than Graphical User Interface (GUI).
If you boot your CentOS 7 core system, you will find a command prompt which will ask you to login to your Linux system. In this command prompt, you can write any command to operate your Linux system. The last line of this command prompt contains four messages.
Here root is the user who have logged in to the system. If you login with another username, it will change according to your user name.
localhost: Hostname of your system.
If you have not changed while installing operating system, it will be localhost by default. It can be changed later by using command.
Location (~): User’s current location will be shown here. As I have logged in as a root user, it is showing (~) means /root cd command is mainly used to change the current location.
For normal user it will be ($) and for the root user it will be (#). User Type in Red Hat Linux There are three types of user in Red Hat Linux system.
System users are those users who cannot login the system but necessary for running various service such mail, ftp, apache etc
Root user: root user is the administrator or super user of Red Hat Linux system. Root user can do any task in Red Hat Linux.
Regular user can login to the system and can do some tasks with limitation but cannot do administrative task. Root user can assign administrative task to any regular user if he wants.
A command run from the command prompt will generally have below structure.
Command -option or argument In Red Hat Linux system, both –option and are optional. A command can perform its task without option and filename or it can take either -option or filename to perform its task.
For example, if you want to show available directories and files in your current location, you can type ls command which will show files and directories in short format.
But if you want to show in long format, you can type ls -l which will show files and directories in long format.
Again if wish to show files and directories in long format within a specific directory, you can type ls –l such as /var/log which will show all the files and directories within the specific directory with long format.
The man command is used to show the manual page of any Red Hat Linux built-in command. It is one of the most useful commands to any Linux system administrator because it helps to find available options and usage of any command with example so easily.
For example, if you want to know details about cd command, just use man command like below. [root@localhost ~] # man cd You will find detail manual page of cd command now. Press UP and Down arrow key to scroll this manual page or type ’q’ to quit this manual page.
ls The ls command shows all the contents in a directory. According to the content color, you can identify the type of any content.
A list of content color is given below. Content Type Color Directory Blue File Black and White Compress File (zip/rar/rpm) Red Executable File Green Device (terminal/cd/dvd/usb/hdd) Yellow Picture/image/media Magenta Link File Cyan A lot of options are available for ls command. Say, if you want to see long listing file format, you can use ls –l command. To know more about ls command options, please use man ls command. You will find details about ls command there.
mkdir The mkdir command is to create a directory in any location in your system. Say, you want to create a directory/folder named class in your current directory. Then use mkdir commend like below. [root@localhost ~] # mkdir class So, you will find a folder named class has been created in your current directory. Use man command to know more about mkdir command.
The touch command is used to create a file your desired directory. Say, you want to create a text file named lecture1 in your current directory. Then use touch command like below.
[root@localhost ~] # touch lecture1 So, you will find a file named lecture1 has been created in your current directory. You will find more details about touch command using man command.
The cp command is used to copy any file or directory. Format of cp command is given below. cp [–option] source file name and path destination file name and path [–option] is optional. Say, if you want to copy your lecture1 file in /var directory with another name, use cp command like below.
The rm command is used to remove any file or directory. It takes file or directory name with path as its argument. Say, you want to delete the lecture1.bak file that you have copied in /var directory with cp command. Then use rm command like below. [root@localhost ~] # rm -f /var/lecture1.bak Your lecture1.bak file will be removed as soon as you execute this command. Here –f is an option which stands for force. If you don’t use this option, you will be asked to confirm for file or directory removal. A lot of options are also available for rm command. Please run man rm command to get details.
shutdown The shutdown command is used to halt, power-off or reboot your Linux system. Say, you want to down your system immediately, use shutdown command like below.
[root@localhost ~] # shutdown now Now your system will go power-off state. If you want to reboot your system, you can use shutdown command with an extra option like below.
[root@localhost ~] # shutdown –r now So, your system will reboot now. A lot of arguments and options are also available for shutdown command. Please see man shutdown command for more details.
here is the much we can take on Simple Approach To Red Hat Linux Commands, but if have any challenge doing any of the above please leave a comment in comment box below.