File-related commands
1, create, and delete operations
Touch touch the modification timestamp stat (atime mtime ctime), if the file is not created the file
-C
MMDDhhmm [CC] YY.ss
Top -> see the process [CPU: sy ur]
-a
Rm
* * [the scope of] the Find -file d -name a * [file properties]
-exec command} {\;
-OK command} {\;
| xargs command;
Mkdir -pv
2, copy and move files
Cp -a // carrying a copy of all file attributes
Mv move 1, 2 move files, rename the file
Music Videos ab &
Music Videos / tmp / A / the root /
filename extension
{}
to create a directory name student number _ Zhao _00001
mkdir {Zhao, Lei} _ {00001,00002}
Zhao _00001
Zhao _00002
Benji _00001
Benji _00002
3, view the file contents
Cat-time view of all the contents of the file
CAT /etc/init.d/
More // man command
/
?
Q
Less in more clear view large files, we use less
Tail default view countdown 10 lines
-n // 20 -n filename simplify tail: -20
* -f * not exit the file, real-time view file contents
head view of the line
-n 20 filename simplify // head -n: -20
4, the other
the Echo -e -n
echo the PATH $
-n // Print ( "the Hello World", End = '\ T') Print ( "the Hello World")
Print ( "the Hello World")
-e identification \ t \ n \ R & lt
echo -n -e "the Hello World \ T"
redirect> and >>
FD file identifier
0 - standard input
1 - standard output
2 - error output
= + Program instruction data
tag variable
Variable inside the data come from? Code execution and data output to where?
States: the default standard input - output standard keyboard - display
redirected is used to change the input and output;
output redirection
> redirect the default work cover can not be removed using this function set -C simultaneously> | can forcibly redirected (set + C open coverage redirection)
>> append redirection in the original file, adding additional data to;
Extended:
? In Linux, the command output in addition to the default output, it also returns a result of the command execution status; return 0 represents the command is executed successfully, and returns non-0 is a failure; $ a name on stored execution state results;
in work, we often do not need the results of the command output, but only command execution state, we will use the redirect will redirect the output to an empty file (/ dev / null)
CAT a.txt> / dev / null
Input redirection
<the back of the document, the previous command to be executed;
TR command will replace the contents of the content in front of the back
TR the ABC ABC <a.txt
<< to multiple lines simultaneously input, the command is used in cat
file EOF cat >> <<
> A
> EOF
Redirect the error output
2> need to bring FD (file identifier)
2 >> additional output error redirection
extended Optimization:
CAT a.txt> / dev / null
CAT a.txt 2> / dev / null
&> / dev / null command executed whether correct or not, will be assigned to the content output / dev / null
& >> [Trivial file]
pipe
command 1 | comand 2 | command 3 | command 4 | .........
the front the command execution result, and outputs to later perform a name;
[Linux Thought: binding of small features, perform complex function]
tail -7 / etc / fstab | cut -d '' -f1
cut cut
-d specified delimiter ''
- f 1-3 3 1 taken column
------------------------------------------------------------------------------------------
Linux Remote
1, view or configure the network card information
Ethernet and IP address
ifconfig
Without this command, we need to install the network tools package (NET-Tools)
APT install NET-Tools
If the card is not up, we need to modify the default network card configuration file;
/ etc / Network / in the interfaces
vim / etc / Network / in the interfaces
1, dynamic - dhcp
Auto eth0
iface eth0 inet dhcp
[modify the configuration file, you need to restart the service]
/ etc / the init.d / Networking the restart
2, static - to manually configure the
address 192.168.94.10
Netmask 255.255.255.0
Gateway 192.168.94.1
2, remote management mechanism
Ssh open ssh port of Ubuntu monitoring function; 22-tcp
netstat -tnl // t - tcp protocol n - not resolve
if not: APT install OpenSSH-Server -y
/etc/init.d / ssh start
[Ubuntu default can only use ordinary users to connect remotely]
ssh [email protected]
under centos, directly from the root user can telnet;
SSH [email protected]
No remote login password
3. LAN connection diagram