Files and directories frequently used commands
Under the command ls
- -a: Displays all subdirectories and files in the specified directory and hidden files
- -l: Displays details of the file list in a way
- -h: displays the file size with the -l
Use wildcards:
*
?
[] Character set
relative path/
touch: file does not exist, create a new file.
If there last file modification time will be modified.
mkdir -p create folders recursively. Examples: mkdir -pa / b / c / d (single sign can not have the same name and the file folder directory)
rm: -f force delete a file is deleted there is no prompt is not being given the information.
-r can delete levels of directories.
Copy and move files
tree: a tree structure lists the directory structure.
tree -d: only displays the directory tree does not display files.
cp: cp source file destination
-i: copy the same files will be found Tips
-r: Copy the file directory
mv: mv source file destination
View the file contents
- more output file contents (split-screen display file contents are more suitable for file content file)
- cat output file contents (see the contents of the file less file)
cat -b (line number file)
cat -n (whether empty rows can have line numbers)
- grep: ^ $ tail head highlight highlighted
echo:> >> Assignment redirected to the specified file
NIC configuration and IP:
-
- If at the end of ping time indicates that the network is open to change if additional instructions are unreasonable network
remote login and copy files:
- ssh username @IP
- scp username @IP: file name or path to the user name @IP: file name and path.
Remote copy files:
sudo (insufficient permissions on the command line when this command is added to the front of the super user permission to operate)Free Password - If at the end of ping time indicates that the network is open to change if additional instructions are unreasonable network
- Configure public key:
-
- ssh-keygen to generate SSH keys all the way round
to upload public key to the server (ssh-copy-id -p port use @ remote)
Configure alias: append ~ / .ssh / config in
-
- Host mac alias name
-
-
- HostName ip地址 User iteamName
Port 22
- HostName ip地址 User iteamName
-
-
- Host mac alias name
-
- ssh-keygen to generate SSH keys all the way round
-
User Permissions: modify directory permissions (chmod + / -rwx filename | directory name)
Group management terminal command to add groups (groupadd group name) delete the group (groupdel group name) to view the group (cat / etc / group)
User management terminal command useradd -m -g group to add a new user name for the new user Delete user userdel -r username
id username to see the user's UID and GID information
whoami front view of a single user login information
who view information for all users currently logged
usermod main user group setting / additional groups