3 Basic Commands and Simple Shell Scripts Once you have your first Red Hat Enterprise Linux rhel


[user@rhel-instance ]$ echo $USER



Download 1.85 Mb.
View original pdf
Page9/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   5   6   7   8   9   10   11   12   ...   67
Pablo Iranzo Gómez, Pedro Ibáñez Requena, Miguel Pérez Colino, Scott McCarty - Red Hat Enterprise Linux 9 Administration-Packt Publishing (2022) -chap 3 82 - 180
[user@rhel-instance
]$ echo $USER

user
[user@rhel-instance
]$ echo $HOME

/home/user
As you can see, you can always refer to USER and it will be substituted with the current user, or to HOME and it will be substituted by the directory dedicated to the user, also known as the home directory.
These are some of the most common and important environment variables:
Table 3.1 – Common environment variables

Using the command line, environment variables, and navigating through the filesystem
71
The
/.bashrc file is the one that should be edited to change these values for the current user.
Important Note
Files starting with a dot (.) are hidden files – to see them, you can use the ls -a command.
Navigating the filesystem
Now, it’s time to move into the directory tree of the system. In Linux and Unix (macOS is a Unix- like system, there are no drive letters, but a single directory tree that starts with the root directory, represented by /. The rest of the content of the system will hang from that folder and any other accessible disk or device will be assigned an accessible directory.
Important Note
The root directory and the home directory for the root user are two different things. The root user is assigned the home directory, root, by default, whereas the root directory is the mother of all directories in the system and is represented by We can see which directory we are in by running the pwd command:
[user@rhel-instance
]$ pwd

/home/user
We can change the directory by using the cd command:
[user@rhel-instance
]$ cd /var/tmp

[user@rhel-instance tmp]$ pwd
/var/tmp
As you already know, there is ab shortcutb for the home directory of the current user,
. We can use this shortcut to go to it:
[user@rhel-instance tmp]$ cd


Download 1.85 Mb.

Share with your friends:
1   ...   5   6   7   8   9   10   11   12   ...   67




The database is protected by copyright ©ininet.org 2024
send message

    Main page