"cd ~" means going to the home directory of the current user
"cd ~aubinxia" means searching the "aubinxia" from /etc/passwd, and get the home directory there, and then go to that directory
"cd ~pulse" means similar thing as above.
aubinxia@aubinxia-fastdev:~$ grep aubinxia /etc/passwd
aubinxia:x:1000:1000:AubinXia,,,:/home/aubinxia:/bin/bash
aubinxia@aubinxia-fastdev:~$ grep pulse /etc/passwd
pulse:x:115:122:PulseAudio daemon,,,:/var/run/pulse:/bin/false
aubinxia@aubinxia-fastdev:~$ cd ~
aubinxia@aubinxia-fastdev:~$ cd ~aubinxia
aubinxia@aubinxia-fastdev:~$ cd ~pulse
bash: cd: /var/run/pulse: No such file or directory
2. Wildcarding
? means any single character
* means any string of characters
so "ls -lrt script*" means any files whose name starts with "script".
[12] means any character who is 1 or 2. so "ls -lrt script?[12]" means any file whose name starts with "script" plus one any character, and end up with 1 or 2.
[!12] , "!" means negate, this means, any character which is not 1 or 2. so "ls script[!12]" means any file whose name starts with script, and end up with one character who is not 1 or 2.
\! in set means ! literally. So "ls -lrt script[12\!]" means any file whose starts with "script, and end up with character who is 1 or 2 or !.
[0-9] means range 0 to 9, "ls -lrt script?[0-9]" means any file whose name starts with script , and plus one any character, and end up with one any number(from 0 to 9) as specified. Note: range expression is not portable, since different system defines code differently.
aubinxia@aubinxia-fastdev:~/Desktop/xxdev$ ls -lrt script*
-rwxrwxr-x 1 aubinxia aubinxia 405 May 10 16:37 script~
-rwxrwxr-x 1 aubinxia aubinxia 962 May 17 19:38 script_2~
-rwxrwxr-x 1 aubinxia aubinxia 1715 May 18 22:13 script_2
-rwxrwxr-x 1 aubinxia aubinxia 155 May 21 21:34 script_1~
-rwxrwxr-x 1 aubinxia aubinxia 15 May 22 21:09 script_1
-rw-rw-r-- 1 aubinxia aubinxia 11 May 22 21:42 script!
aubinxia@aubinxia-fastdev:~/Desktop/xxdev$ ls -lrt script?[12]
-rwxrwxr-x 1 aubinxia aubinxia 1715 May 18 22:13 script_2
-rwxrwxr-x 1 aubinxia aubinxia 15 May 22 21:09 script_1
aubinxia@aubinxia-fastdev:~/Desktop/xxdev$ ls -lrt script[!12]
-rwxrwxr-x 1 aubinxia aubinxia 405 May 10 16:37 script~
-rw-rw-r-- 1 aubinxia aubinxia 11 May 22 21:42 script!
aubinxia@aubinxia-fastdev:~/Desktop/xxdev$ ls -lrt script[12\!]
-rw-rw-r-- 1 aubinxia aubinxia 11 May 22 21:42 script!
aubinxia@aubinxia-fastdev:~/Desktop/xxdev$ ls -lrt script?[0-9]
-rwxrwxr-x 1 aubinxia aubinxia 1715 May 18 22:13 script_2
-rwxrwxr-x 1 aubinxia aubinxia 15 May 22 21:09 script_1
No comments:
Post a Comment