1, System basic information Query
View Kernel
#uname-A
View Ubuntu version
#cat/etc/issue
View kernel-loaded modules
#lsmod
View PCI Devices
#lspci
View USB Devices
#lsusb
View Network card Status
#sudo Ethtool eth0
View CPU Information
#cat/proc/cpuinfo
Display current hardware information
#lshw
To view the partition of a hard disk
#sudo fdisk-l
Viewing IDE hard disk information
#sudo hdparm-i/dev/hda
View Stat Drive Information
#sudo hdparm-i/DEV/SDA
Or
#sudo Apt-get Install Blktool
#sudo BLKTOOL/DEV/SDA ID
To view the remaining space on your hard disk
#df-H
#df-H
View Directory Footprint
#du-HS Directory Name
The USB drive can't be uninstalled
#sync Fuser-km/media/usbdisk
To view current memory usage
#free-M
2, network card configuration, take eth0 as an example
2.1. Configuring the NIC in DHCP mode
Edit File/etc/network/interfaces:
#sudo vi/etc/network/interfaces
Replace the line with the following line for eth0:
# The primary network Interface-use DHCP to find our address
Auto Eth0
Iface eth0 inet DHCP
Use the following command to make the network settings effective:
#sudo/etc/init.d/networking Restart
Of course, you can also enter the following command directly under the command line to get the address
#sudo dhclient eth0
2.2 Configuring a static IP address for the NIC
Edit File/etc/network/interfaces:
#sudo vi/etc/network/interfaces
Replace the line with the following line for eth0:
# The Primary network interface
Auto Eth0
Iface eth0 inet Static
Address 192.168.3.90
Gateway 192.168.3.1
Netmask 255.255.255.0
Network 192.168.3.0
Broadcast 192.168.3.255
Replace the above IP address with the information you have.
Use the following command to make the network settings effective:
#sudo/etc/init.d/networking Restart
2.3 Setting a second IP address (virtual IP address)
Edit File/etc/network/interfaces:
#sudo vi/etc/network/interfaces
Add the following line to the file:
Auto Eth0:1
Iface eth0:1 inet Static
Address 192.168.1.60
Netmask 255.255.255.0
Network x.x.x.x
Broadcast x.x.x.x
Gateway x.x.x.x
Fill in all information, such as address,netmask,network,broadcast and gateways, according to your situation. The above is the case of static IP, if you are dynamically obtaining an address, simply change static to DHCP, without the following parameters.
Use the following command to make the network settings effective:
#sudo/etc/init.d/networking Restart
3. Set the host name (hostname)
Use the following command to view the host name of the current host:
#sudo/bin/hostname
Use the following command to set the host name of the current host:
#sudo/bin/hostname newname
When the system starts, it reads the name of the host from/etc/hostname.
4. Configure DNS
First, you can add some host names and IP addresses for these host names in/etc/hosts, which is a static query that uses native computers simply.
To access the DNS server for querying, you need to set the/etc/resolv.conf file.
Assuming that the IP address of the DNS server is 192.168.3.2, then the contents of the/etc/resolv.conf file should be:
Search test.com
NameServer 192.168.3.2
5. Service Management
Add a service
#sudo UPDATE-RC.D Service Name defaults 99
Delete a service
#sudo UPDATE-RC.D Service Name remove
Temporarily restart a service
#/etc/init.d/Service Name Restart
Temporarily shut down a service
#/etc/init.d/Service Name Stop
Temporarily start a service
#/etc/init.d/Service Name Start
6. File Decompression
Decompression xxx.tar.gz
#tar-ZXVF xxx.tar.gz
Decompression xxx.tar.bz2
#tar-JXVF xxx.tar.bz2
Compression AAA BBB directory for xxx.tar.gz
#tar-ZCVF xxx.tar.gz AAA BBB
Compression AAA BBB directory for XXX.TAR.BZ2
#tar-JCVF xxx.tar.bz2 AAA BBB
Extracting RAR Files
1) Install first
#sudo apt-get install RAR unrar
#sudo ln-f/usr/bin/rar/usr/bin/unrar
2) Unzip
#unrar x Aaaa.rar
Unzip the ZIP file
1) Install first
#sudo apt-get Install zip unzip
#sudo ln-f/usr/bin/zip/usr/bin/unzip
2) Unzip
#unzip x Aaaa.zip
7. Frequently Used shortcuts
New Terminal: Ctrl+alt+t
Console switchover:
Press ALT+CTRL+F1 to switch to the character interface
Press ALT+CTRL+F7 to switch to the graphical interface
If the UBUNTN is started in command-line mode, the character terminal wants to return to the graphical interface with the following command:
$startx
Common basic commands for Ubuntu systems