In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Common commands:
Files and directories:
# cd /home Go to '/home' directory
# cd .. Back to Top
# cd ../.. Back to top two levels
# cd -Return to last directory
# cp file1 file2 Copy file1 to file2
# cp -a dir1 dir2 Copy a directory
# cp -a /tmp/dir1 . Copy a directory to the current working directory (. stands for current directory)
# ls View files in directory
# ls -a Show hidden files
# ls -l Show details
# ls -lrt Display files by time (l for detailed list, r for reverse sort, t for chronological sort)
# pwd Show work path
# mkdir dir1 Create directory 'dir1'
# mkdir dir1 dir2 Create two directories simultaneously
# mkdir -p /tmp/dir1/dir2 Create a directory tree
# mv dir1 dir2 Move/rename a directory
# rm -f file1 delete 'file1'
# rm -rf dir1 Delete the contents of directory 'dir1' and its subdirectories
View file content:
# cat file1 Look forward from the first byte to the contents of the file
# head -2 file1 View the first two lines of a file
# more file1 View the contents of a long file
# tac file1 Review the contents of a file backwards from the last line
# tail -3 file1 View the last three lines of a file
Text processing:
# grep str /tmp/test Find "str" in file '/tmp/test'.
# grep ^str /tmp/test Find lines starting with "str" in file '/tmp/test'.
# grep [0-9] /tmp/test Find all rows containing numbers in the file '/tmp/test'
# grep str -r /tmp/* Find "str" in directory '/tmp' and its subdirectories
# diff file1 file2 Find the difference between the two files
# sdiff file1 file2 shows the difference between two files in a comparative manner
Find:
# find / -name file1 Go to root file system from '/' to find files and directories
# find / -user user1 Find files and directories belonging to user 'user1'
# find /home/user1-name \*.bin Find files ending in '.bin' in directory '/ home/user1'
# find /usr/bin -type f -atime +100 Find executables that have not been used in the last 100 days
# find /usr/bin -type f -mtime -10 Find files created or modified within 10 days
# locate \*.ps Find files ending in '.ps' by running 'updatedb'
# find -name '*. [ch]' |xargs grep -E 'expr' Finds 'expr' in all.c and.h files in the current directory and its subdirectories
# find -type f -print0 |xargs -r0 grep -F 'expr' Finds 'expr' in regular files in the current directory and its subdirectories
# find -maxdepth 1 -type f |xargs grep -F 'expr' Find 'expr' in current directory
Compression and decompression:
# bzip2 file1 zip file1
# bunzip2 file1.bz2 unzip file1.bz2
# gzip file1 zip file1
# gzip -9 file1 Maximum compression file1
# gunzip file1.gz Unzip file1.gz
# tar -cvf archive.tar file1 Wrap file1 into archive.tar
(-c: Create compressed file;-v: Show all processes;-f: Use file name, required, last parameter)
# tar -cvf archive.tar file1 dir1 Wrap file1, dir1 into archive.tar
# tar -tf archive.tar Displays the contents of a package
# tar -xvf archive.tar frees a package
# tar -xvf archive.tar -C /tmp Release the archive to/tmp directory
# zip file1.zip file1 Create a zip file
# zip -r file1.zip file1 dir1 Compress files and directories into a zip file
# unzip file1.zip unzip a zip file to the current directory
# unzip test.zip-d /tmp/extract a zip file to/tmp directory
yum tools:
# yum -y install [package] Download and install an rpm package
# yum localinstall [package.rpm] Install an rpm package and resolve all dependencies using your own software repository
# yum -y update Update all rpm packages installed on the current system
# yum update [package] Update an rpm package
# yum remove [package] Remove an rpm package
# yum list List all packages installed on the current system
# yum search [package] Search for packages in rpm repository
# yum clean [package] Clear packages from cache directory (/var/cache/yum)
# yum clean headers Remove all headers
# yum clean all Delete all cached packages and headers
Network:
# ifconfig eth0 shows the configuration of an Ethernet card
# ifconfig eth0 192.168.1.1 netmask 255.255.255.0 Configure IP address of NIC
# ifdown eth0 disable 'eth0' network device
# ifup eth0 Enable 'eth0' network devices
#config iveth 2 shows the configuration of a wireless network card
# iwlist scan shows wireless networks
# ip addr show Displays the IP address of the NIC
Other:
# su -Switch to root privileges (different from su)
# shutdown -h now shutdown
# shutdown -r restart now
# top List Linux tasks that use the most CPU resources (enter q to exit)
# pstree shows programs as a tree
# man ping See reference manual (e.g. ping command)
# passwd Change password
# df -h Displays disk usage
# cal -3 Displays calendar for previous month, current month and next month
# cal 10 1988 Display calendar for specified month, year
# date --date '1970-01-01 UTC 142788888 seconds' converts a number of seconds relative to 1970-01-01 00:00 into time
Common shortcuts:
In CentOS 6.4, you can set shortcuts through System-> Preferences-> Keyboard Shortcuts, as shown in the figure. For example, you can set the shortcut key for running the terminal to Ctrl+Alt+T.
Ctrl + u Delete the character before the cursor to the beginning of the line
Ctrl + k Delete characters before cursor to end of line
Ctrl + c cancels the command entered in the current line, equivalent to Ctrl + Break
Ctrl + a moves the cursor ahead of the line, equivalent to the usual Home key
Ctrl + e Move cursor to end of line
Ctrl + f Move the cursor forward one character position
Ctrl + b Move the cursor backward one character position
Ctrl + l clears the screen, equivalent to executing the clear command
Ctrl + r displays a: prompt to find related history commands based on user input (reverse-i-search)
Ctrl + w Delete the cursor from the beginning to the beginning of the word
Ctrl + t Swap the two characters preceding the cursor position
Ctrl + y Paste the last deleted word
Ctrl + Alt + D Display Desktop
Alt + b Move the cursor backward to the previous word
Alt + d Delete the cursor from the cursor position to the end of the current word
Alt + F2 Run
Alt + F4 Close the current window
Alt + F9 Minimize the current window
Alt + F10 Maximize the current window
Alt + Tab Toggle window
Alt + Left key to move the window (or scroll the mouse wheel in the bottom taskbar)
[Middle mouse button] Paste highlighted text. Use the left mouse button to select text. Point the cursor where you want to paste the text. Click the middle mouse button to paste.
[Tab]Command line autocompletion. This is used when using shell prompts. Type the first few characters of a command or file name, and then press the [Tab] key, which automatically completes the command or displays all commands that match the typed characters.
Press/directly in desktop or file manager to enter location and open file manager.
Quick Search: Press/directly in vi or Firefox to enter search status.
Web links and images can be dragged and dropped directly to your desktop or catalog for immediate download.
Drag files from File Manager directly to Terminal to get complete pathnames in Terminal.
Click the middle mouse button in the empty space of the scroll bar, and the screen will scroll to that place.
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.