Home  >  Article  >  Operation and Maintenance  >  Linux command summary

Linux command summary

巴扎黑
巴扎黑Original
2017-06-23 14:08:032027browse
Basic commands
sudo -i -u accout_name switches to the user named accout_name
sudo -i switches to the root user
sudo -u switches to Specify user
cd to switch to the root directory
cd .. Switch to the upper level directory, use cd ../../../../ to switch up to 4 levels from the bottom up Root directory
pwd View the current directory
echo $profile_name View the Path of a system variable, Ex: echo $JAVA_HOME
./start_up.sh or sh start_up.sh Execute this command in the bin directory of a certain installed software, that is, start the software, such as tomcat
copy
cp file_name destinct_file_name Copy name=file_name to destinct_file_name, completely overwrite, destinct_file_name does not need to be created in advance
cp -rf directory_name1 distinct_derectory_name2 Copy the hierarchical directory directory_name1 to distinct_derectory_name2
Delete
rm -r * Recursively delete all files in the current directory
rm -rf directory name recursively force deletion
Create
mkdir directory Create directory
mkdir -p directory1/directory2 Create multi-level directories at one time
touch file_name Create file
Process related
ps -aux|grep ps_name Check the process with a process name = ps_name to get the process ID number. Start time and other information
kill -9 ps_id Kill a process with id=ps_id
jps Display the pid of all current Java processes, including id and name
pwdx Pass Find the startup directory corresponding to the file by PID number
View the file content
more Display the file content page by page more file_name
cat Connect and display Information about one or more specified files cat file1 file2
vi edit
/pattern searches the string of pattern backward from the current position. After the search is successful, Enter, click n on the keyboard to match the next
:set paste Copy the content from wins to linux, after vi, enter this command to avoid confusion in the sorting of the copied content
i Insert content
:q Exit without editing
:q! Edited but do not need to save and exit
:wq Save the edit and exit
Find
find .|grep -rn “string_name” -l Find files with string_name field in the current directory

The above is the detailed content of Linux command summary. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn