Linux environment variables, cp,mv command, More,less,cat,tail,head, use
[Email protected] ~]# cp/usr/bin/ls/tmp/
[Email protected] ~]# path= $PATH: Use of/tmp/path
[Email protected] ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/tmp/
[[email protected] ~]# Vi/etc/profile Permanent Entry Add Path variable value in this configuration file
[[email protected] ~]# echo $PATH use of new assignments
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/tmp/
[Email protected] ~]# Path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
Cp
[[email protected] ~]# cp-r/dabaitu//tmp/copy directory with option-R
[[email protected] ~]# cp-r/tmp/nc//TMP/NC/CP Copy a file if the target file exists, he will put the original directory under the target directory.
If the target directory does not exist, he will copy the original directory, modify a name.
MV Command
[Email protected] tmp]# mkdir 1.txt If you change the name in the same directory if the target file already exists, he will ask if he wants to overwrite it.
[Email protected] tmp]# MV 1.txt/2.txt If the target is a directory and the directory does not exist, he will change the name of the directory. If the target directory exists, he will put the original target In the catalogue.
[[email protected] tmp]# ls
2.txt Alex systemd-private-2b74b96d2c354f119f60360cbd9383fa-ntpd.service-0d Dvfj
Aegis-<guid (5A2C30A2-A87D-490A-9281-6765EDAD7CBA) > NC
Cat
[[email protected] ~]# cat-a/etc/passwd Cat is to view the contents of a file-A is at the end plus a $
root:x:0:0:root:/root:/bin/bash$
bin:x:1:1:bin:/bin:/sbin/nologin$
[[email protected] ~]# cat-n/etc/passwd-n can show the line number
1 Root:x:0:0:root:/root:/bin/bash
2 Bin:x:1:1:bin:/bin:/sbin/nologin
More
Also view the contents of the file
[[email protected] ~]# more/etc/passwd is press the space a screen down view by Shift+b online view
Root:x:0:0:root:/root:/bin/bash
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon:x:2:2:daemon:/sbin:/sbin/nologin
[[email protected] ~]# wc-l/etc/passwd can see how many lines of a file
26/etc/passwd
[[email protected] ~]# head/etc/passwd view a file cast 10 lines
Root:x:0:0:root:/root:/bin/bash
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon:x:2:2:daemon:/sbin:/sbin/nologin
Adm:x:3:4:adm:/var/adm:/sbin/nologin
Lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
Sync:x:5:0:sync:/sbin:/bin/sync
Shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
Halt:x:7:0:halt:/sbin:/sbin/halt
Mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
Operator:x:11:0:operator:/root:/sbin/nologin
[[email protected] ~]# tail/etc/passwd look at the end of a file 10 lines
Dbus:x:81:81:system message Bus:/:/sbin/nologin
Polkitd:x:997:995:user for Polkitd:/:/sbin/nologin
Tss:x:59:59:account used by the trousers package to sandbox the TCSD Daemon:/dev/null:/sbin/nologin
Postfix:x:89:89::/var/spool/postfix:/sbin/nologin
Sshd:x:74:74:privilege-separated Ssh:/var/empty/sshd:/sbin/nologin
Ntp:x:38:38::/etc/ntp:/sbin/nologin
NSCD:X:28:28:NSCD Daemon:/:/sbin/nologin
Tcpdump:x:72:72::/:/sbin/nologin
Dabaitu:x:1000:1000::/home/dabaitu:/bin/bash
User:x:1001:1001::/home/user:/bin/bash
[[email protected] ~]# head-n 2/etc/passwd only look at the first two lines
Root:x:0:0:root:/root:/bin/bash
Bin:x:1:1:bin:/bin:/sbin/nologin
[[email protected] ~]# tail-n 2/etc/passwd only look at the following two lines
Dabaitu:x:1000:1000::/home/dabaitu:/bin/bash
User:x:1001:1001::/home/user:/bin/bash
[[email protected] ~]# tail-f/etc/passwd View a log or document of a dynamic file
Usage of less
Press the Space one screen one screen down see press the direction up and down ctrl+b upward ctrl+f down press n,n down press Q exit
Press/and? Search for a keyword and make a volume display
Shift+g forward, shift+g, backward.
This article is from the "11325852" blog, please be sure to keep this source http://11335852.blog.51cto.com/11325852/1975906
Linux environment variables, cp,mv command, More,less,cat,tail,head, use