System ProgrammingLearn how to use Linux Red Hat

Learn how to use Linux Red Hat

Red-Hat-Linux-Administration

After installing Red Hat, we need to know how to use it. This is going to be the subject of this article. Have a nice reading!!

Login to Your Linux Box
When you boot your Linux machine, the boot process will end up with a screen like the following:
1

This is the login screen. To use the system, you need first to authenticate to the system, by providing your credentials. Credentials are valid user and password. In our case, type root as a user (and press Enter), and redhat as its password (and press Enter again).

The Shell
Once authenticated to the system, you get a command-line prompt like the following:
2

This is called the Shell. In the first article of this series “Red Hat Linux Administration – (1) Introduction“, I told you that the Linux shell is an interactive command-line interface where a user can type a command, and get its result(s). I told you also that the Linux shell lies of top of the kernel (which is the core of the Linux operating system).

Over years, several shells have been developed. The most used, well-known types are Bourne Shell sh, Korn Shell ksh, C-Shell csh, and the Bourne-Again Shell bash. Each shell has its own features, and uses. The default shell in Red Hat Linux is the Bash Shell.

So, a user is first asked to present what proves he is a legal authentic user of the system. When his credentials are verified, a startup program is loaded for that user. The default startup program for Linux users is the (bash) shell.

Using the Shell
As a Linux admin, the shell is your main playground. From the shell you do the following:

  • Display system info and parameters.
  • Display contents of configuration files.
  • Edit/modify configuration files.
  • Create your own data files.
  • Write and execute shell scripts.
  • Start, stop, reload, and restart services.

Almost all your work is done from the shell. That is an important reason for you to learn and master using shell. Of course, that will not happen in a day!! But, let me tell you something: stay with us, and you will be not only a shell master, but a master of Linux as well. Promise!!

The Shell Prompt Structure
Here is the default prompt you see in your Red Hat Linux bash shell:

[root@localhost ~]#

Where:

root is the current logged in user for this login session.
localhost is the host (computer) name.
~ is called Tilde. It is a short for the path of home directory of the current user.
# is the prompt to write your commands after.

The whole structure of bash shell prompt is changeable using an environment variable PS1. Later, when we come to customizing the bash shell, and to using Environment Variables, we will see how to play with this variable to change the shell prompt as you prefer.

Typing Commands
As a rule, Linux commands use the following general syntax:

COMMAND [OPTIONs] [ARGUMENTS]

Where COMMAND is the command name.

OPTIONs are zero or more options. Command options are preceded by – or –.
ARGUMENTs are zero or more data items needed for the command to execute. Most of the time, arguments are file names or directory paths.

The following table lists the basic Linux commands, with brief description for the function of each, and a simple usage example.

Command Function / Description
ls List the contents of a directory.
3
pwd Print Working Directory.
4
cd Change Directory
5
cat Concatenate and Print the contents of file(s)
6
tac Concatenate and Print the contents of file(s) in reverse.
7
rev Reverse the lines of file(s)
8
man Display the Manual Page for a command
9
cp Copy file(s) or directory(ies)
10
mv Move or Rename file or directory
11
rm Remove file(s) or directory(ies)
12
mkdir Make directory
13
rmdir Remove “an empty” directory
14
date Print or Set the system date and time.
15
touch Change file(s) timestamps. If the file(s) don’t exist, it will be created.
16
more Print file contents one screen at a time.
17
less Similar to more , but allows both forward and backward movement in the file.
18
seq Print a sequence of numbers between Start and End.
19
echo Print line(s) of text to the standard output (screen).
20
cal Display the Calendar (of month or entire year)
21
22
clear Clear the terminal screen.

Summary

  • To use a Linux system, you need first to login to it using a valid user and password.
  • The default startup program for most of users is a command-line shell.
  • The default shell for Linux is the bash shell.
  • The shell works like a command-line interpreter, where commands are typed, executed, and have their results displayed to the user.

References and Recommended Readings
https://blog.eduonix.com/shell-scripting/introduction-to-linux-shell-scripting/

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Exclusive content

- Advertisement -

Latest article

21,501FansLike
4,106FollowersFollow
106,000SubscribersSubscribe

More article

- Advertisement -