In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Xiaobian to share with you about the linux basic command details, I hope you read this article after the harvest, let us discuss it together!
Linux basic commands are: 1, pwd to display the current path;2, rmdir to delete empty directory;3, ls to view directory or file information;4, vi to text editor;5, cp to copy;6, mv to move;7, rm to delete files or directories;8, find to find files.
Linux basic commands are:
1. pwd: Show current path
cd: switch directories
Usage: CD
cd ../ Switch to parent directory
cd /Switch to root directory
cd ~(or cd only) Switch to the current user's home directory (folder named after the user under home) /root directory
mkdir Create directory
mkdir directory name-p recursively create directory
2. rmdir: Delete empty directories
Usage: rmdir directory name
Also available: rm -rf directory name
3.ls: View directory or file information
Main options:
-l Lists directory or file details. such as permissions, modification times, etc.
-a Lists all files in the current directory, including hidden files (all hidden files are marked at the beginning)
4.vi Text Editor
Type i to enter edit mode
Press ESC to exit editing
Don't save exit: :q!
Save Exit: :wq
Enter/to enter search
Enter:set nu to display the number of rows per row
Press the G key, you can directly locate to the end
5. cp replication
Usage: cp [options] File name or directory destination address
-R Copy directories and all directories and files under directories
cp a.txt b.txt Copy file a and rename file b (directory name)
6.mv Mobile
Usage: mv file name or directory destination directory
mv a.txt ../ Move a file to a parent directory (move one file to another without renaming)
mv a.txt ../ b.txt Move a file up one level and rename it b file (move a file to another directory and rename it)
7.rm Delete a file or directory
-f Forced deletion
-r Delete directory
Common: rm -rf file or directory
8. find Find files
Usage: find [path] [option]
Common options are:
find . -name *.log Finds files ending in.log in the current directory
find / -name log Find the directory named log in the root directory
9. grep filtering
Finds a character (string) in the specified file and prints the line
Usage: grep string filename
grep band file Find the band string in file
10.cat Display text file content
Usage: cat file name cat file name
11. Head Look at the first few lines
Usage: head -n 5 filename
12. tail Writes a file to standard output from a specified point
tail -n 5 file name View the next few lines
tail -f error.log keeps refreshing to see the latest content
13.ps View progress (dynamic)
-ef Displays all running processes and the command to start them
14. netstat View network status (short for net status)
netstat -apn View all ports
an, arrange output in a certain order
p indicates which process is calling
15.| pipe character (vertical line, English input method state shift+ keyboard on the|\)
Pipelines between commands, taking the output of the previous command as the input to the subsequent command
Find tomcat process by command: ps -ef| grep tomcat
Find the process number occupying this port through the command: netstat -apn| grep 8080
16. echo Print or edit file content
Common options are:
-n No newline output
-e can use escape characters (\nEnter,\t tab)
Examples:
echo "I am studying linux">> xujun.txt Append the end of the file
echo $? If the return value is 0, the last command was successful. If it's between 1 and 255, it's a failure.
echo -e "wo\tshi\tshei"> xujun.txt
17. touch creates a blank file and updates the timestamp of the file if the same file exists in the current directory
-a Modify access time
-m modify (modify) time These two parameters can be understood
18. Uname View System
-m View how many bits the system is operating system
-r View the kernel version of the system
-a View detailed kernel versions and operating systems
19.rz upload
If you don't have this command in your system, use yum install lrzz to install
-y cover
Enter rz directly and you can upload files
20.sz Download
If you don't have this command in your system, use yum install lrzz to install
-y cover
sz -y test.txt
21.su Switch Users
su root
22. history View command history
23. chmod permission grant command
-R Recursively change permissions on all subdirectories and files in a directory
Number: r=4 w=2 x=1
chmod 777 lemon
24. tar decompression, compression tar.gz
tar -czvf test.tar.gz test
Compress the test folder to test.tar.gz
tar -xzvf test.tar.gz
Unzip test.tar.gz to get the test folder
25.zip unzip, zip
zip -r test.zip test
Zip the test folder to test.zip, you must have r to compress the file, otherwise an empty folder will be generated
unzip test.zip
Extract the test.zip folder
26. turn off the firewall
Open: service iptables start
Close: service iptables stop
27. View files from end to end
tac
28. shutdown
Permanently turn off the firewall
Open: chkconfig iptables on
Close: chkconfig iptables off
After reading this article, I believe you have a certain understanding of the detailed explanation of the basic Linux commands. If you want to know more about it, welcome to pay attention to the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.