File
Role: View the type of file
Common options:
-B does not display file names when listing file identification results
-F list file type of file name (equivalent to write file or directory location in a file, bulk view, after F to follow the file)
Instance:
[Email protected] ~]# file/etc/etc:directory[[email protected] ~]# file/etc/passwd/etc/passwd:ascii text[[email prote CTED] ~]# file/dev/sda/dev/sda:block special[[email protected] ~]# file-b/dev/sdablock special[[email protected] ~]# [ [email protected] ~]# cat 1/etc/etc/passwd/dev/sda[[email protected] ~]# file-f 1/etc:directory/etc/passwd:ascii Text/dev/sda:block Special[[email protected] ~]# FILE-BF 1directoryASCII TextBlock special[[email protected] ~]#
which
Function: Searches for the location of a system command in the path specified by the path variable, and returns the first search result
Instance:
[email protected] ~]# which lsalias ls= ' ls--color=auto '/bin/ls[[email protected] ~]# which pwd/bin/pwd[[email protected ] ~]# which Cpalias cp= ' cp-i '/bin/cp[[email protected] ~]# which Cd/usr/bin/which:no CD in (/usr/lib64/qt-3.3/bin:/usr/ Local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) [[email protected] ~]#
Because the CD is a command built in bash! But which by default is to find the directory within the PATH, so of course it must not be found
Wc
Role: Statistics file related information
Common options:
-L count rows
-W count words. A word is defined as a string separated by a blank, a jump, or a newline character
-C Statistics byte number
-L PRINT the longest line length
Instance:
[[email protected] ~]# wc -l /etc/passwd37 /etc/passwd #37行 [[email protected] ~]# wc -w /etc/passwd57 /etc/passwd #57个字 [[email protected] ~]# wc -c /etc/passwd1752 /etc/passwd #1752个字节 [[email protected] ~]# wc / etc/passwd 37 57 1752 /etc/passwd #默认显示行数, number of words, total bytes [[email protected] ~]# wc -l /etc/passwd79 /etc/passwd #最长的一行有79个字节 [[email protected] ~]#
LN
: Establishes a synchronized link to a file in another location
Comments:
Links can be divided into two types: Hard link and soft link (symbolic link), hard link means that an archive can have multiple names,
The soft link is the way to produce a special file, the contents of which is pointing to the location of another file.
Hard links exist in the same file system, but soft links can span different file systems.
Soft Links:
1. Soft links exist in the form of a path. Similar to the shortcut in the Windows operating system
2. Soft links can cross file systems, hard links cannot be
3. Soft links can link to a nonexistent file name
4. Soft links can link to a directory
Hard links:
1. Hard links, exists as a copy of the file. But does not occupy the actual space.
2. Do not allow hard links to directories
3. Hard links can only be created in the same file system
There are two points to note:
First, the LN command maintains the synchronization of each linked file, that is, no matter where you change it, The other files will change in the same way;
Second, Ln's links are also soft links and hard links, the soft link is the ln–s source file destination file, it will only generate a file in the location of your selected image
, does not occupy disk space, Hard-Link ln source file destination file, no parameter-s, it generates a file with the same size as the source file in the location you selected,
whether it is a soft link or a hard link, the file keeps changing synchronously. The
 LN directive is used in linked files or directories, such as specifying more than two files or directories at the same time, and the final destination is a directory that already exists, and all of the previously specified files or directories are copied to the directory.
If you specify multiple files or directories at the same time, and the final destination is not an existing directory, an error message appears.
Common options:
-s soft Connect (symbolic Link)
instance:
[[email protected] ~]# echo "123" >/tmp/hi[[email protected] ~]# ln -s /tmp/hi hi_solink[[email protected] ~]# lltotal 0lrwxrwxrwx. 1 root root 7 mar 30 13:04 hi_solink -> /tmp/hi[[email protected] ~]# cat hi_solink 123[[email protected] ~]# echo 321 >> hi_solink [[email protected] ~]# cat hi_solink /tmp/hi 123321123321[[ Email protected] ~]# rm -rf hi_solink [[email protected] ~]# cat /tmp/hi 123321[[email protected] ~]#[[email protected] ~]# echo " Hardlink " > /tmp/hello[[email protected] ~]# ln /tmp/hello hd_link[[ Email protected] ~]# lltotal 4-rw-r--r--. 2 root root 9 Mar 30 13:06 hd_link[[email protected] ~]# echo "Plus" >> hd_link [[email protected ] ~]# cat hd_link /tmp/hello hardlinkplushardlinkplus[[email protected] ~]# rm -rf hd_link [[email protected] ~]# cat /tmp/hello hardlinkplus[[email protected] ~]#
Link source File Destination file
Link can only do hard links
This article from "Step by step into the Linux World" blog, reproduced please contact the author!
Common basic commands for Linux 08