mkdir (Make directory)
Function: Create a directory case: mkdir Test Reviews: will create a directory named Test directory
RmDir (remove directory)
Function: Delete directory case: rmdir Test Reviews: will delete catalog test
Mv
Function: Mobile Directory Example one: MV mvtest Test Reviews: Move directory mvtest to catalog test example two: MV mvtest mvtest2 Reviews: Example of renaming effect three: MV Test test2 mvtest Reviews: Will catalog test test2 And move it down to mvtest.
What are the instructions for viewing a document? And what are their characteristics?
Cat starts displaying the contents of the archive from the first line the TAC is displayed by the last line, the content is reversed when the NL display, the Output line number more page by page of the Display file content (enter down one line, the space down a page, Q left more mode) less and more similar, But better than the more, you can page forward (can be PageUp pagedown to page, the space to turn pages, Q left) head only a few lines (head-n with the number can specify how many rows) tail only see the last few lines (tail-n With numbers you can specify how many lines are displayed) OD reads the contents of the file in binary way
How do I create a new document?
Using touch commands to achieve
The touch directive can not only create new documents, but also modify document dates
Case:
LL is an alias of ls-l, in fact is a meaning touch-d "2 days Ago" Testtouch feature: Change the file Testtouch date to a two-day advance, where-D represents the number of days touch Testtouch function: Create file testtouchtouch-t 1307030202 Testtouch function: Modify the date of the file Testtouch to July 3, 2013 2:2,-T is a time format
The use of umask?
Umask has a lot to do with the preset management of files.
For example, the value of Umask is 0022.
The permissions for new files and folders are
Let's create a new file and folder to see
[Email protected]:~/tmp# touch test1[email protected]:~/tmp# mkdir test2-rw-r--r-- 1 root root 0 2013-06-05 16:15 test1drwxr-xr-x 2 root root 4096 2013-06-05 16:15 test2
As you might imagine.
So let's reset the umask to 0002 to see
Umask 0002
[Email protected]:~/tmp# rm test1[email protected]:~/tmp# rmdir test2[email protected]:~/tmp# Touch test1[email protected]:~/tmp# mkdir test2-rw-rw-r-- 1 root root 0 2013-06-05 16:22 test1drwxrwxr-x 2 root Root 4096 2013-06-05 16:20 test2/
This time, only one w is removed
How do I set the hidden properties of a document?
A: Add a special parameter with chattr+-Remove a special parameter = only the next parameter a sets the attribute, the access time of the file or directory Atime (access) will not be modified. S write data to disk to avoid data loss a after setting a, this file can only increase the data, cannot delete the data C setting this property, will automatically compress the document I can make a file cannot be deleted, renamed, set the link can not write or add information. Wait a minute.. The more commonly used are a and I
Case:
[Email protected]:~/tmp# touch attrtest[email protected]:~/tmp# chattr +i attrtest[email protected]:~/tmp# RM attrtestrm : Cannot remove ' attrtest ': Operation not permitted
How do I see Hidden properties?
A: Through the LSATTR directive
Case:
[Email protected]:~/tmp# lsattr attrtest-----A-----------e-attrtest[email protected]:~/tmp# chattr-a attrtest[email protected]:~/tmp# lsattr attrtest-----------------e-attrtest
How do I modify document permissions?
Answer: Modify by executing chmod
Case:
[Email protected]:~/tmp# touch attrtest[email protected]:~/tmp# chmod 777 Attrtest[email protected]:~/tmp# Lltotal 16drwxrwxr-x 4 jiqing9006 jiqing9006 4096 2013-06-05 17:03./drwxr-xr-x jiqing9006 jiqing9006 4096 2013-06-05 15:21 .. /-rwxrwxrwx 1 root root 0 2013-06-05 17:03 attrtest*drwxrwxr-x 5 jiqing9006 jiqing9006 4096 2013-06-04 15:24 mvtest/-rw-rw-r-- 1 root root 0 2013-06-05 16:22 test1drwxrwxr-x 2 root root 4096 2013-06-05 16:20 test2/-rw-r--r-- 1 root root 0 2013-07-03 02:02 Testtouch
How do I search for documents?
Answer: Usually first use Whereis or locate to check, if really can not find, only find to search. Whereis and locate are using a database to search for data, so it's fairly fast, and there's no real hard disk search, which saves time.
And the find speed is slow, also operate the hard drive.
Case:
which search execution file
[Email protected]:~/tmp# which passwd
/usr/bin/passwd
[Email protected]:~/tmp# which passwd-a
/usr/bin/passwd
Whereis Search for specific files
[Email protected]:~/tmp# whereis passwdpasswd:/usr/bin/passwd/etc/passwd/usr/share/man/man5/passwd.5.gz/usr/share /man/man1/passwd.1ssl.gz/usr/share/man/man1/passwd.1.gz
-B Find binary files only
-m just look for the file below manual.
-S only find source
[Email protected]:~/tmp# whereis-b passwdpasswd:/usr/bin/passwd/etc/passwd[email protected]:~/tmp# whereis-m PASSWDPASSWD:/usr/share/man/man5/passwd.5.gz/usr/share/man/man1/passwd.1ssl.gz/usr/share/man/man1/passwd.1.gz
Tips
Basically, Linux searches for database updates every day for all the files on the Linux host, and the updated program is
UpdateDB. Of course, you can also use/usr/bin/updatedb directly to update the database file!
Locate
[Email protected]:~/tmp# Locate passwd/etc/passwd. /var/lib/dpkg/info/passwd.postinst/var/lib/dpkg/info/passwd.preinst
Find queries the hard drive
[Email protected]:~/tmp# find/home/jiqing9006-mtime 0/home/jiqing9006/home/jiqing9006/file/home/jiqing9006/. Viminfo/home/jiqing9006/tmp/home/jiqing9006/tmp/test2/home/jiqing9006/tmp/mvtest/demo. /home/jiqing9006/.cache/zeitgeist/daemon.log.2013-06-04/home/jiqing9006/.cache/zeitgeist/daemon.logfind: '/home /jiqing9006/.gvfs ': Permission denied
The above instruction indicates that the query changes within 24 hours of the file, 0 means from current to 24 hours ago.
The Find/-mtime 3 represents 24 hours before three days.
Summary:
What is an absolute path versus a relative path?
How do I change the name of a directory? For example, change from/home/test to/home/test2
Mv/home/test/home/test2
What is the meaning of PATH in this environment variable?
This is the directory path that is used to specify the file search when execution is performed.
What is the use and merit of umask?
Umask can take away some attributes, so the appropriate definition of umask helps the system to be secure, as he can use to establish a default directory or file permissions. when a user's umask is 033 and 044, what permissions do they have to create files and directories? when Umask is 033, the default is to take out the group and other W (2) x (1) permissions, so that the permissions become "file-rw-r--r--, directory drwxr--r--" and when Umask 044, the properties of R are removed, so It becomes "file-rw--w--w-, directory Drwx-wx-wx"
What is SUID?
When an instruction has the function of SUID, the program will have the permission of the owner of the instruction when the instruction is used by others.
What commands can I use to query/usr/bin/passwd when I want to query some properties of this file?
Ls-al, file, lsattr
Try to find out what's in the current Linux system, all files with SUID?
Find/-type F-perm-4000-print
Creation, query, modification of the Linux instruction file