First, the system operation (boot, shutdown, landing, etc.) command
Option name |
Use formatting |
Meaning |
Reboot |
Enter the carriage |
Restart now |
Shutdown |
Shutdown–r now |
Restart now |
Shutdown–r 20:35 |
20:35 restart |
Shutdown–r 10 |
Restart after 10 minutes |
Halt |
Enter the carriage |
Shut down now. |
Shutdown |
Shutdown–h now |
Shut down now. |
Shutdown–h 20:35 |
20:35 Turn off the machine |
Shutdown–h 10 |
20:35 Turn off the machine |
Exit |
Enter the carriage |
Exit |
Second, file directory operation
Option name |
Use formatting |
Meaning |
Cd |
CD [DirName] |
Jump directory to DirName |
DirName As the path name |
Absolute path |
A path name that begins with "/", such as/root |
Cd/root |
Jump to the root directory that is your own homedirectory |
There are C disk D drives under Win7, but Linux has only one root directory-"/", while "~" represents the user's home homedirectory, i.e. "/" + "user" record |
"/" root directory Top level |
CD/ |
Jump to the root directory, which is the top level directory |
Relative path |
“.” or null character |
CD. or CD |
Jump to current directory |
“..” |
Cd.. |
Skip to top level directory |
"~" or "~/" |
Represents the Host Directory |
/root/file=~/file |
~ |
CD ~ |
Jump to HomeDirectory |
Pwd |
Pwd |
Show current path name |
Ls |
Ls–a |
All files listed under the directory include hidden |
Ls–l |
List the details of a file |
Ls–f |
Viewing files in a directory |
ll |
LL's not an order, it's Ls-l's nickname. |
List the details of a file |
Mkdir |
mkdir Dir1 |
Create a directory called ' Dir1 ' |
mkdir Dir1 Dir2 |
Create two directories at a time |
Mkdir-p/tmp/dir1/dir2 |
Create a directory tree |
Rm |
Rm-f file1 |
Delete a file called ' File1 ' |
RM-RF Dir1 Dir2 |
Delete two directories and their contents at the same time |
RM-RF Dir1 |
Delete a directory called ' Dir1 ' and delete its contents at the same time |
RmDir |
RmDir Dir1 |
Delete a directory called ' Dir1 ', can only delete empty directory, cannot delete directory with files |
Mv |
MV Dir1 New_dir |
Rename/move a directory Dir1 to New_dir |
Cp |
CP file1 File2 |
Copy a file content to File2 |
CP dir/*. |
Copy all files under a directory to the current working directory |
Cp-a/tmp/dir1. |
Copy a directory to the current working directory |
Cp-a Dir1 Dir2 |
Copy a directory |
More, Cat |
more filename or cat filename |
View File Contents |
Stat |
Stat filename |
View file status |
Tar |
TAR–XZVF xxx |
Unzip the file |
Third, permission operation
Option name |
Use formatting |
Meaning |
chmod |
chmod [-R] nnn file or directory |
Modify permissions for a file or directory |
Chown |
chown [ options ] User [ . Group ] file/dir |
Modify the owner of a file |
Chgrp |
Chgrp [-R] Group name Dir/file |
Modify the owning group of a file |
Iv. Systems and Networks
Option name |
Meaning |
passwd xxx |
Change Password |
Df-ah |
View disk space |
Ps-ef |grep |
View process |
Kill-9 |
Kill the process |
Vi/etc/profile |
modifying environment variables |
Vi/etc/sysconfig/network Vi/etc/hosts |
Modify Host Name |
Vi/etc/sysconfig/network-scripts/ifcfg-eth0 |
Modify IP Address |
Service Iptables Stop Chkconfig iptables off |
Shutting down the firewall |
Setenforce Permissive Modify/etc/selinux/config |
Turn off SELinux |
passwd xxx |
Change Password |
Hadoop diary Day6---common commands for Linux