Linux command shell

1. Command aliases that are permanently effective for the current user

1. Write a command named hello. The function implemented is that every time the hello command is entered, hello will be written to the file /file.txt for everyone.

"alias" command, append "hello, everyone" to "file.txt"
Please add image description

2. Write a command aliased as shuaxin. The function achieved is that every time the command is entered, all times in the file.txt file are updated to the current time.

"touch" updates file time
Please add image description

2. Command aliases that are valid for all users

In the third-level title, write a command alias hh that is valid for all users. After each user enters this command, a file1 file can be created in the user's home directory.

Enter "vim /etc/bashrc"
Please add image description
and write the code "alias hh='touch ~/file1'" at the end of bashrc
Please add image description
to call the view. After entering the code, enter "source /etc/bashrc" to re-execute the newly modified command and enter " hh", and then check the creation time of "file1".

Please add image description

3. Command history: View the command history and call the tenth line of commands

Please add image description
Please add image description

Guess you like

Origin blog.csdn.net/Nirvana92/article/details/127511388