Basic Linux commands-general Linux technology-Linux technology and application information. For more information, see the following section. Basic1: shutdown: init 0 or shutdown-h now
Basic2: restart: init 6 or reboot or shutdown-r now
1. function: Force delete all files in the directory
Command: rm-rf *
Note: This command is executed within the directory you want to operate. to delete this directory, execute this command in the upper-level directory of this directory:
Rm-rf directory name
2. function: view environment variables
Command: echo $ PATH
3. function: Add Environment Variables
Command: PATH = $ PATH: absolute PATH
4. function: view disk usage
Command: df-h
5. function: View partition information
Command: fdisk-l
6. function: view directory details
Command: du-h
7. function: Search for files
Command: find destdir-name filename or whereis filename or locate filename (you must first execute updatedb)
8. function: copy a directory
Command: cp-r * sourceDir destDir
9. function: Check whether an rpm is installed.
Command: rpm-aq | grep-I rpmName
Note: parameter I indicates case-insensitive
10. function: uninstall rpm
Command: rpm-e rpmName
11. function: Search for files based on the Content
Command: find destDir-type f | xargs grep-I kerwords
12. function: Add a default route
Command: ip route add default via IPADDR
13. function: Xwindow Type Switch
Command: switchdesk KDE or GNOME or others
Note: The premise is that you have installed these xwindows
14. function: add the environment variable to the file. Sometimes the environment variable added after the command is restarted when PATH = $ PATH:/is directly executed. This operation can avoid this situation.
Operation: Change the init runlevel in the/ect/inittab file. There are seven options: 0-6. Generally, choose 3 or 5.
16. function: Create a soft link
Command: ln-s srcfile linkfilename
Note: just create a hard link and remove the parameter s.
17. function: grant File Permissions
Command: chmod + x filename (add executable permission)
Note: Add executable permissions to all files in a directory: chmod + x ./*
18. function: network configuration (taking static IP configuration as an example)
Operation: vi/etc/sysconfig/network-scripts/ifcfg-eth0, edit as follows
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = none
IPADDR = your ip
NETMASK = mask
GATEWAY = GATEWAY
Ip information is now configured, and then configure DNS
Vi/ect/resolv. conf
Nameserver dns1
Nameserver dns2
Restart the network service and run the service network restart command.
19. function: automatic loading of new drivers (taking network drivers as an example)
Operation: first import the e1000.o plugin to/lib/modules/2.6.18. */kernel/drivers/net folder, and then execute insmod e1000.o or modify this file/etc/modules. conf, add the following statement alias eth0 e1000, so that the system will automatically load the driver library when the system starts.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service