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



Download 1.85 Mb.
View original pdf
Page11/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   7   8   9   10   11   12   13   14   ...   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
]# h

halt hardlink hash h dparm head
help hexdump history hostid hostname
hostnamectl hwclock
This capability can be extended to help complete other parts of our commands by installing the bash-completion package:
[user@rhel-instance
]# yum install bash-completion –y

Tip
A good practice when installing a system is to install bash-completion and also create or update the manuals database with the mandb command to get the latest manuals available using the man command.
Previous commands
There is away to recover the last commands run, which is referred to as history, in case you want to rerun them. Just press the up arrow key (the one with an arrow pointing up) and the previous commands will appear onscreen.
If there are too many commands in your history, you can search through them quickly by running the history command:
[user@rhel-instance
]$ history

1 su root
2 su
3 su -
4 id
5 id root
6 grep user /etc/passwd
7 echo $USER
8 echo $HOME
9 declare
10 echo $SHELL
11 echo EDITOR

Basic Commands and Simple Shell Scripts
74
12 echo $EDITOR
13 grep wheel /etc/gro
14 grep wheel /etc/group
15 cat /etc/group
16 grep nobody /etc/group /etc/passwd
You can run any of those commands again by using the ! command. Just run ! with the number of the command and it will run again:
[user@rhel-instance
]$ !5

id root
uid=0(root) gid=0(root) groups=0(root)
Tip
The !! command will run the very last command again, no matter which number.
Now, it is time to enjoy your superfast command line. Let’s learn more about the structure of directories in Linux, to know whereto go to find things, in the following section.

Download 1.85 Mb.

Share with your friends:
1   ...   7   8   9   10   11   12   13   14   ...   67




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

    Main page