Use your Linux keyboard

Source: Internet
Author: User
Use your Linux keyboard-general Linux technology-Linux programming and kernel information. For more information, see the following. Correct use of the symbols on the keyboard can help you fully apply various techniques when writing simple scripts.

[Tab] is used to automatically complete a command, path, or file name.

[Root @ localhost ~] # After Entering the user, the user can connect to the [Tab] key on the keyboard to list commands starting with the user.

[Root @ localhost ~] # After Entering usera, usera can press the [Tab] key on the keyboard to automatically complete the useradd command starting with usera.

[Root @ localhost ~] # After useradd is input, you can press the [Tab] key twice on the keyboard to list all files and directories in the current directory.

~ This symbol represents the user's home directory.

[Root @ localhost ~] # Cd/

[Root @ localhost ~] # Pwd

[Root @ localhost ~] # Cd ~

[Root @ localhost ~] # Pwd

! Add this symbol before a command to call the previous command starting with this command in the command history [root @ localhost ~] # Find/root/install. log

[Root @ localhost ~] # File/root/install. log

[Root @ localhost ~] #! F The command will call file/root/install to find the file.

[Root @ localhost ~] #! Fi will call the file/root/install command to find the file.

[Root @ localhost ~] #! Fin will call the find/root/install command to find the file.

$ Is used to reference a variable.

[Root @ localhost ~] # Myhost = www.liuziyang.cn

[Root @ localhost ~] # Echo $ myhost

& At the end of a command, the task is run in the background

% Indicates the number of a task (the task is not a process ).

[Root @ localhost ~] # While true; do echo hello>/dev/tty2; sleep 1; done &

[Root @ localhost ~] # While true; do echo www.liuziyang.cn>/dev/tty2; sleep 1; done &

[Root @ localhost ~] # [Ctrl] + [alt] + [F2] here it means to switch to the second console/dev/tty2 and view the output result

After each execution of the following command, switch between [ctrl] + [alt] + [F1] and [F2] To see a result change.

[Root @ localhost ~] # Jobs

[Root @ localhost ~] # Fg % 1

[Root @ localhost ~] # [Ctrl] + z the combination of [ctrl] and z on the keyboard

[Root @ localhost ~] # Jobs [root @ localhost ~] # Kill % 2

[Root @ localhost ~] # Jobs

[Root @ localhost ~] # Bg % 1

[Root @ localhost ~] # Jobs

[Root @ localhost ~] # Kill % 1 ''represents a command or script'' represents a string "" represents a string

Check the output result of each command.

[Root @ localhost ~] # Echo 'hostname'

[Root @ localhost ~] # Echo 'hostname'

[Root @ localhost ~] # Echo "hostname" | pipeline symbol used for filtering after a command statement

[Root @ localhost ~] # Ls-l/etc | more

[Root @ localhost ~] # Cat/etc/passwd | awk-F: '{print $7}' | sort | uniq

^ Match the start of a string

$ Match the end of a string

> Targeted symbols

<Targeted symbol

> Append symbol

Note that the output results of each command are compared.

[Root @ localhost ~] # Grep ^ root </etc/passwd> result1.txt

[Root @ localhost ~] # Cat result1.txt

[Root @ localhost ~] # Grep bash $ </etc/passwd> result1.txt

[Root @ localhost ~] # Grep bash $ </etc/passwd> result2.txt

[Root @ localhost ~] # Cat result1.txt

[Root @ localhost ~] # Cat result2.txt

[Root @ localhost ~] # Grep root </etc/passwd> result2.txt

[Root @ localhost ~] # Cat result2.txt

Write this first. You can understand these commands and apply them to the actual situation through more hands-on practices.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.