Linux view some commands for system information and commands to view installed packages (GO)

Source: Internet
Author: User
Tags ftp site


# uname-a               # View kernel/Os/cpu info # head-n 1/etc/issue   # view OS version # Cat/proc/cpuinfo      # View CPU Info # hostname               # View Meter Computer name # LSPCI-TV              # List all PCI devices # LSUSB-TV              # list all USB devices # Lsmod                  # list loaded kernel modules # env                    # View Environment variables


# free-m                # View memory usage and swap usage # df-h                  # View each partition usage # du-sh < directory name >        # View the size of the specified directory # grep memtotal/proc/meminfo< c13/># View Total Memory # grep memfree/proc/meminfo    # View Idle amount # Uptime                 # View System uptime, number of users, load # CAT/PROC/LOADAVG      # View System load

Disks and partitions

# Mount | Column-t      # View attached partition status # fdisk-l               # View all partitions # swapon-s              # View all swap partitions # hdparm-i/DEV/HDA     # View disk parameters (for IDE devices only) # DMESG | grep IDE       # view IDE Device detection status at startup


# ifconfig               # View the properties of all network Interfaces # iptables-l            # View firewall settings # route-n               # View routing table # NETSTAT-LNTP          # View all listening ports # NETSTAT-ANTP          # View all established connections # NETSTAT-S             # View Network statistics


# ps-ef                 # View All Processes # Top                    # Real-time display process status


# w                      # View active user # ID < username >            # View specified user information # Last                   # View user log in log # cut-d:-f1/etc/passwd   # View system All users # cut-d: -f1/etc/group    # View system All groups # Crontab-l             # View Current user's scheduled tasks


# chkconfig--list       # List all system Services # Chkconfig--list | grep    on # List all started system services


# RPM-QA                # View all installed Packages


In the Linux operating system, there is a system package that functions like "Add/Remove Programs" in Windows, but is much more powerful than Add/Remove Programs, which is Red Hat package Manager (RPM). The 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 remove software under Linux. Here is a brief introduction to the use of its specific methods.

1. We get a new software, before the installation, it is generally necessary to check the contents of this package, assuming that this 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 the details of the package, including information about how many files, file names, file size, creation time, compile date, and so on.

2. All the files listed above are not necessarily installed at the time of installation, just like Windows under the installation of the program is divided into typical, full, custom, Linux will let you choose the installation method, at this time we can use this command to see the package will be installed in the system which parts, in order to facilitate our choice:

RPM-QPL linux-1.4-6.i368.rpm

3. After selecting the installation method, start the installation. We can install this software with the RPM-IVH linux-1.4-6.i368.rpm command. During the installation process, if you are prompted to install the software or for other reasons, but if we do want to execute the installation command, you can add a parameter "-replacepkgs" after-IVH:

rpm-ivh-replacepkgs linux-1.4-6.i368.rpm

4. Sometimes we uninstall one of the installed software, just execute rpm-e < file name >; command.

5. Upgrading low-version software is a good way to improve its functionality, so as to save us the hassle of installing new software after uninstalling, to upgrade a software, you only need to execute the following command: RPM-UVH < filename;;, note: The file name at this point must be the upgrade patch to upgrade the software

6. Another way to install the software is the uniqueness of Linux, but also a manifestation of RMP's powerful features: Install the software directly online via the FTP site. Once you have found the site containing the software you need and connected to this website, execute the following command to install online, for example, to install linux-1.4-6.i368.rpm online, you can use the command:


7. In our use of the computer process, it will inevitably be wrong to operate, if we mistakenly deleted a few files and affect the performance of the system, how to find out what exactly is missing files? The RPM package provides a function to find corrupted files and execute this command: Rpm-va, Linux will list all corrupted files for you. You can fix it through the Linux installation CD.

8.Linux system of many files, in the course of use, will inevitably encounter the files we do not know, under Windows we can use the "Start/Find" menu to quickly determine which folder a file belongs to, in Linux, The following command line can help us quickly determine which package a file belongs to:

RPM-QF < file name >;

9. When each package is installed on a Linux system, the installation files will be "checked in" in the RPM database, so we need to look up the properties of one of the installed software just to find it in this database. Note: The query command at this point is different from the query described in 1 and 8, and this method only applies to packages that have already been installed! Command format:

RPM-Parameters < file names >;


Apt-get update--to run the command after modifying/etc/apt/sources.list or/etc/apt/preferences. In addition, you need to run this command regularly to ensure that your package list is up-to-date.
Apt-get Install a new package packagename--(see aptitude below)
Apt-get Remove packagename--Uninstall an installed package (keep config file)
Apt-get--purge Remove packagename--Uninstall an installed package (delete configuration file)
dpkg--force-all--purge PackageName Some software is difficult to uninstall, but also to prevent the application of other software, you can use this, but a bit risky.
Apt-get AutoClean Apt will back up the installed or unloaded software on the hard drive, so if you need space, you can let this command to delete the software you have deleted
Apt-get Clean This command will also remove the backup of the installed software, but this will not affect the use of the software.
Apt-get upgrade--Update all installed packages
Apt-get dist-upgrade--upgrading the system to a new version
Apt-cache search string--searching for strings in the package list
Dpkg-l package-name-pattern--lists all packages that match the pattern. If you do not know the full name of the package, you can use "*package-name-pattern*".
aptitude--view the installed or available packages in detail. Similar to Apt-get, aptitude can be called by command-line mode, but only for certain commands-the most common are installation and uninstallation commands. Since aptitude has more information than apt-get, it can be said to be more suitable for installation and uninstallation.
Apt-cache showpkg pkgs--Displays package information.
Apt-cache dumpavail--Print the list of available packages.
Apt-cache Show pkgs--shows the package record, similar to Dpkg–print-avail.
Apt-cache pkgnames--The name of all packages in the print packages list.
Dpkg-s file--This file belongs to which installed package.
Dpkg-l package--lists all the files in the package.
Apt-file Search filename--finds packages that contain specific files (not necessarily installed) that contain the specified string in the file name. The Apt-file is a standalone package. You must first install it using the Apt-get install and then run Apt-file update. If apt-file search filename outputs too much content, you can try using Apt-file search FileName | Grep-w filename (shows only those filenames where the specified string appears as the complete word) or a similar method, for example: Apt-file search FileName | Grep/bin/(it is helpful to show only files that are located in folders such as/bin or/usr/bin, if you are looking for a specific executable file).

Linux view some commands for system information and commands to view installed packages (GO)

Related Article

Contact Us

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: 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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.