Turn: http://www.cnblogs.com/chenwenbiao/archive/2011/07/18/2109983.html
System
# Uname-A # view kernel/OS/CPU information # Head-N 1/etc/issue # view OS version # Cat/proc/cpuinfo # view CPU information # hostname # view computer name # lspci-TV # list all PCI devices # lsusb-TV # list all USB devices # lsmod # list loaded kernel modules # env # view environment variables
Resources
# Free-M # view memory usage and swap zone usage # DF-h # view usage of each partition # Du-SH <Directory Name> # view the size of a specified directory # grep memtotal/proc /meminfo # view the total memory # grep memfree/proc/meminfo # view the Amount of idle memory # uptime # view the system running time, number of users, and load # Cat/proc/loadavg # view the system load
Disks and partitions
# Mount | column-T # view the status of the mounted partition # fdisk-L # view all partitions # Swapon-s # view all swap partitions # hdparm-I/dev/hda # view disk parameter (applicable only to ide devices) # dmesg | grep ide # view the IDE Device Detection Status at startup
Network
# Ifconfig # view the attributes of all network interfaces # iptables-L # view firewall settings # route-N # view route tables # netstat-lntp # view all listening ports # netstat-antp # view all established connection # netstat-s # view network statistics
Process
# Ps-Ef # view all processes # top # display Process status in real time
User
# W # view active users # id <User Name> # view specified user information # last # view User Logon logs # Cut-D: -F1/etc/passwd # view all users in the system # Cut-D:-F1/etc/group # view all groups in the system # crontab-L # view the scheduled tasks of the current user
Service
# Chkconfig -- list # list all system services # chkconfig -- list | grep on # list all started system services
Program
# Rpm-Qa # view all installed software packages
Rpm
In a Linux operating system, there is a system software package, which functions similar to "Add/delete programs" in windows, but is much more powerful than "Add/delete programs, it is Red Hat Package Manager (RPM ). This toolkit was first launched by Red Hat and later borrowed by other Linux developers. Because it saves Linux users a lot of time, it is widely used to install and delete software in Linux. The following describes how to use it.
1. We get a new software, before installation, usually first check what content in this package, assuming the file is: Linux-1.4-6.i368.rpm, we can use this command to view:
Rpm-QPI Linux-1.4-6.i368.rpm
The system will list detailed information about the software package, including the number of files, file names, file size, Creation Time, and compilation date.
2. all the files listed above are not necessarily installed at the time of installation, just as the installation methods of Windows programs are classified into typical, complete, and custom. Linux also allows you to choose the installation method, in this case, we can use the following command to check which parts of the software package will be installed in the system to facilitate our selection:
Rpm-qpl Linux-1.4-6.i368.rpm
3. Select the installation method and start installation. We can install this software with the rpm-IVH Linux-1.4-6.i368.rpm command. During the installation process, if the system prompts that the software has been installed or cannot be installed for other reasons, but if we do want to execute the installation command, you can add the parameter "-replacepkgs" after-IVH ":
Rpm-IVH-replacepkgs Linux-1.4-6.i368.rpm
4. Sometimes, to uninstall an installed software, you only need to run the rpm-E <File Name>; command.
5. upgrading a lower version of the software is a good way to improve its functions. This saves us the trouble of installing new software after uninstalling it. To upgrade a software, you only need to execute the following command: rpm-uvh <File Name>; note: the file name must be the patch for upgrading the software.
6. Another method for installing software is Linux's unique feature. It is also a manifestation of RMP's powerful functionality: directly installing software online through FTP sites. When you find a site that contains the software you need and connect to this site, execute the following command to achieve online installation, such as online installation of Linux-1.4-6.i368.rpm, you can use the command:
Rpm-IFtp://ftp.pht.com/pub/linux/redhat/...-1.4-6.i368.rpm
7. When we use computers, we will inevitably encounter misoperations. If we accidentally delete a few files and affect the system performance, how can we find out which files are missing? The RPM package provides a function to find corrupted files. Run this command: rpm-va. Linux will list all corrupted files for you. You can fix the issue through the Linux installation CD.
8. in Linux, there are many files, which we will inevitably encounter when using. in windows, we can use the "Start/search" menu to quickly determine which folder a file belongs, in Linux, the following command line can help us quickly determine which software package a file belongs:
Rpm-QF <File Name>;
9. after each software package is installed in Linux, the installation file is "reported" in the RPM database. Therefore, when we want to query the attributes of an installed software, you only need to search for the database. Note: The query command is different from the query commands described in 1 and 8. This method is only applicable to installed software packages! Command Format:
Rpm-parameter <File Name>;
Apt-Get
Apt-Get update -- run this command after modifying/etc/APT/sources. List or/etc/APT/preferences. In addition, you need to regularly run this command to ensure that your package list is up-to-date.
Apt-Get install packagename -- install a new software package (see aptitude below)
Apt-Get remove packagename -- uninstall an installed software package (keep the configuration file)
Apt-Get -- purge remove packagename -- uninstall an installed software package (delete the configuration file)
Dpkg -- force-all -- purge packagename some software is hard to uninstall, and it can be used to block other software applications, but it is a little risky.
Apt-Get autoclean apt will back up installed or unloaded software on the hard disk, so if you need space, you can run this command to delete the software you have deleted.
The apt-Get clean command will also delete the backup of the installed software, but this will not affect the use of the software.
Apt-Get upgrade -- update all installed software packages
Apt-Get dist-upgrade -- upgrade the system to the new version.
Apt-cache search string -- search for strings in the package list
Dpkg-l package-name-pattern -- list all software packages that match the pattern. If you do not know the full name of the software package, you can use "* package-name-pattern *".
Aptitude-view installed or available software packages in detail. Similar to Apt-Get, aptitude can be called through the command line, but is limited to some commands-the most common commands are installation and uninstallation. Because aptitude knows more information than apt-get, it is more suitable for installation and uninstallation.
Apt-Cache showpkg pkgs -- displays the package information.
Apt-Cache dumpavail -- print the list of available packages.
Apt-Cache show pkgs -- displays Software Package records, similar to dpkg-print-avail.
Apt-Cache pkgnames -- print the names of all packages in the package list.
Dpkg-s file -- the package to which the file belongs.
Dpkg-l package -- list all files in the package.
Apt-File
Search
Filename -- find a software package that contains a specific file (not necessarily installed). The file names contain the specified strings. Apt-file is an independent software package. You must
Install apt-Get install first, and then run apt-file update. If apt-file search
Filename outputs too much content. You can try to use apt-file search filename | grep-W
Filename (only show the names of the complete words in the specified string) or similar methods, such as apt-file search filename |
Grep/bin/(only files in folders such as/bin or/usr/bin are displayed. If you want to find a specific execution file, this is helpful ).
Turn: http://www.cnblogs.com/chenwenbiao/archive/2011/07/18/2109983.html
System
# Uname-A # view kernel/OS/CPU information # Head-N 1/etc/issue # view OS version # Cat/proc/cpuinfo # view CPU information # hostname # view computer name # lspci-TV # list all PCI devices # lsusb-TV # list all USB devices # lsmod # list loaded kernel modules # env # view environment variables
Resources
# Free-M # view memory usage and swap zone usage # DF-h # view usage of each partition # Du-SH <Directory Name> # view the size of a specified directory # grep memtotal/proc /meminfo # view the total memory # grep memfree/proc/meminfo # view the Amount of idle memory # uptime # view the system running time, number of users, and load # Cat/proc/loadavg # view the system load
Disks and partitions
# Mount | column-T # view the status of the mounted partition # fdisk-L # view all partitions # Swapon-s # view all swap partitions # hdparm-I/dev/hda # view disk parameter (applicable only to ide devices) # dmesg | grep ide # view the IDE Device Detection Status at startup
Network
# Ifconfig # view the attributes of all network interfaces # iptables-L # view firewall settings # route-N # view route tables # netstat-lntp # view all listening ports # netstat-antp # view all established connection # netstat-s # view network statistics
Process
# Ps-Ef # view all processes # top # display Process status in real time
User
# W # view active users # id <User Name> # view specified user information # last # view User Logon logs # Cut-D: -F1/etc/passwd # view all users in the system # Cut-D:-F1/etc/group # view all groups in the system # crontab-L # view the scheduled tasks of the current user
Service
# Chkconfig -- list # list all system services # chkconfig -- list | grep on # list all started system services
Program
# Rpm-Qa # view all installed software packages
Rpm
In a Linux operating system, there is a system software package, which functions similar to "Add/delete programs" in windows, but is much more powerful than "Add/delete programs, it is Red Hat Package Manager (RPM ). This toolkit was first launched by Red Hat and later borrowed by other Linux developers. Because it saves Linux users a lot of time, it is widely used to install and delete software in Linux. The following describes how to use it.
1. We get a new software, before installation, usually first check what content in this package, assuming the file is: Linux-1.4-6.i368.rpm, we can use this command to view:
Rpm-QPI Linux-1.4-6.i368.rpm
The system will list detailed information about the software package, including the number of files, file names, file size, Creation Time, and compilation date.
2. all the files listed above are not necessarily installed at the time of installation, just as the installation methods of Windows programs are classified into typical, complete, and custom. Linux also allows you to choose the installation method, in this case, we can use the following command to check which parts of the software package will be installed in the system to facilitate our selection:
Rpm-qpl Linux-1.4-6.i368.rpm
3. Select the installation method and start installation. We can install this software with the rpm-IVH Linux-1.4-6.i368.rpm command. During the installation process, if the system prompts that the software has been installed or cannot be installed for other reasons, but if we do want to execute the installation command, you can add the parameter "-replacepkgs" after-IVH ":
Rpm-IVH-replacepkgs Linux-1.4-6.i368.rpm
4. Sometimes, to uninstall an installed software, you only need to run the rpm-E <File Name>; command.
5. upgrading a lower version of the software is a good way to improve its functions. This saves us the trouble of installing new software after uninstalling it. To upgrade a software, you only need to execute the following command: rpm-uvh <File Name>; note: the file name must be the patch for upgrading the software.
6. Another method for installing software is Linux's unique feature. It is also a manifestation of RMP's powerful functionality: directly installing software online through FTP sites. When you find a site that contains the software you need and connect to this site, execute the following command to achieve online installation, such as online installation of Linux-1.4-6.i368.rpm, you can use the command:
Rpm-IFtp://ftp.pht.com/pub/linux/redhat/...-1.4-6.i368.rpm
7. When we use computers, we will inevitably encounter misoperations. If we accidentally delete a few files and affect the system performance, how can we find out which files are missing? The RPM package provides a function to find corrupted files. Run this command: rpm-va. Linux will list all corrupted files for you. You can fix the issue through the Linux installation CD.
8. in Linux, there are many files, which we will inevitably encounter when using. in windows, we can use the "Start/search" menu to quickly determine which folder a file belongs, in Linux, the following command line can help us quickly determine which software package a file belongs:
Rpm-QF <File Name>;
9. after each software package is installed in Linux, the installation file is "reported" in the RPM database. Therefore, when we want to query the attributes of an installed software, you only need to search for the database. Note: The query command is different from the query commands described in 1 and 8. This method is only applicable to installed software packages! Command Format:
Rpm-parameter <File Name>;
Apt-Get
Apt-Get update -- run this command after modifying/etc/APT/sources. List or/etc/APT/preferences. In addition, you need to regularly run this command to ensure that your package list is up-to-date.
Apt-Get install packagename -- install a new software package (see aptitude below)
Apt-Get remove packagename -- uninstall an installed software package (keep the configuration file)
Apt-Get -- purge remove packagename -- uninstall an installed software package (delete the configuration file)
Dpkg -- force-all -- purge packagename some software is hard to uninstall, and it can be used to block other software applications, but it is a little risky.
Apt-Get autoclean apt will back up installed or unloaded software on the hard disk, so if you need space, you can run this command to delete the software you have deleted.
The apt-Get clean command will also delete the backup of the installed software, but this will not affect the use of the software.
Apt-Get upgrade -- update all installed software packages
Apt-Get dist-upgrade -- upgrade the system to the new version.
Apt-cache search string -- search for strings in the package list
Dpkg-l package-name-pattern -- list all software packages that match the pattern. If you do not know the full name of the software package, you can use "* package-name-pattern *".
Aptitude-view installed or available software packages in detail. Similar to Apt-Get, aptitude can be called through the command line, but is limited to some commands-the most common commands are installation and uninstallation. Because aptitude knows more information than apt-get, it is more suitable for installation and uninstallation.
Apt-Cache showpkg pkgs -- displays the package information.
Apt-Cache dumpavail -- print the list of available packages.
Apt-Cache show pkgs -- displays Software Package records, similar to dpkg-print-avail.
Apt-Cache pkgnames -- print the names of all packages in the package list.
Dpkg-s file -- the package to which the file belongs.
Dpkg-l package -- list all files in the package.
Apt-File
Search
Filename -- find a software package that contains a specific file (not necessarily installed). The file names contain the specified strings. Apt-file is an independent software package. You must
Install apt-Get install first, and then run apt-file update. If apt-file search
Filename outputs too much content. You can try to use apt-file search filename | grep-W
Filename (only show the names of the complete words in the specified string) or similar methods, such as apt-file search filename |
Grep/bin/(only files in folders such as/bin or/usr/bin are displayed. If you want to find a specific execution file, this is helpful ).