20150121-3 选题

This commit is contained in:
DeadFire 2015-01-21 16:51:17 +08:00
parent 4fc1280f93
commit 55f0d498d4
3 changed files with 336 additions and 0 deletions

View File

@ -0,0 +1,64 @@
Linux FAQs with Answers--How to boot into command line on Ubuntu or Debian
================================================================================
> **Question**: I am running Ubuntu desktop, but I want to boot straight into text-mode console temporarily. What is a convenient way to disable desktop GUI and boot into a terminal?
Linux desktop comes with a display manager (e.g., GDM, KDM, LightDM), which lets the desktop machine automatically boot into a GUI-based login environment. However, what if you want to disable GUI and boot straight into a text-mode console? For example, you are troubleshooting desktop related issues, or want to run a heavy-duty application that does not require desktop GUI.
Note that you can temporarily switch from desktop GUI to a virtual console by pressing Ctrl+Alt+F1 to F6. However, in this case your desktop GUI will be still running in the background, and thus is different from pure text-mode booting.
On Ubuntu or Debian desktop, you can enable text-mode booting by passing appropriate kernel parameters.
### Boot into Command-line Temporarily ###
If you want to disable desktop GUI and boot in text-mode just one-time, you can use GRUB menu interface.
First, power on your desktop. When you see the initial GRUB menu, press 'e'.
![](https://farm8.staticflickr.com/7490/16112246542_bc1875a397_z.jpg)
This will lead you to the next screen, where you can modify kernel booting parameters. Scroll down the screen to look for a line that begins with "linux", which indicates a list of kernel parameters. Remove from the list "quiet" and "splash". Add "text" in the list instead.
![](https://farm8.staticflickr.com/7471/15493282603_8a70f70af2_z.jpg)
The updated kernel parameter list looks like the following. Press Ctrl+x to continue booting. This will enable one-time console booting in verbose mode.
![](https://farm8.staticflickr.com/7570/15925676530_b11af59243_z.jpg)
Boot into Command-line Permanently
If you want to boot into command-line permanently, you need to [update GRUB configuration][1] which defines kernel booting parameters.
Open a default GRUB config file with a text editor.
$ sudo vi /etc/default/grub
Look for a line that starts with GRUB_CMDLINE_LINUX_DEFAULT, and comment out that line by prepending # sign. This will disable the initial splash screen, and enable verbose mode (i.e., showing the detailed booting procedure).
Then change GRUB_CMDLINE_LINUX="" to:
GRUB_CMDLINE_LINUX="text"
Next, uncomment the line that says "#GRUB_TERMINAL=console".
The updated GRUB defult configuration looks like the following.
![](https://farm9.staticflickr.com/8673/16107564442_9345d94491_b.jpg)
Finally, invoke update-grub command to re-generate a GRUB2 config file under /boot, based on these changes.
$ sudo update-grub
At this point, your desktop should be switched from GUI booting to console booting. Verify this by rebooting.
![](https://farm8.staticflickr.com/7518/16106378151_81ac6b5a49_b.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/boot-into-command-line-ubuntu-debian.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://xmodulo.com/add-kernel-boot-parameters-via-grub-linux.html

View File

@ -0,0 +1,115 @@
Linux FAQs with Answers--How to check CPU info on Linux
================================================================================
> **Question**: I would like to know detailed information about the CPU processor of my computer. What are the available methods to check CPU information on Linux?
Depending on your need, there are various pieces of information you may need to know about the CPU processor(s) of your computer, such as CPU vendor name, model name, clock speed, number of sockets/cores, L1/L2/L3 cache configuration, available processor capabilities (e.g., hardware virtualization, AES, MMX, SSE), and so on. In Linux, there are many command line or GUI-based tools that are used to show detailed information about your CPU hardware.
### 1. /proc/cpuinfo ###
The simpliest method is to check /proc/cpuinfo. This virtual file shows the configuration of available CPU hardware.
$ more /proc/cpuinfo
![](https://farm8.staticflickr.com/7572/15934711577_4136a8e0b9_c.jpg)
By inspecting this file, you can [identify][1] the number of physical processors, the number of cores per CPU, available CPU flags, and a number of other things.
### 2. cpufreq-info ###
The cpufreq-info command (which is part of **cpufrequtils** package) collects and reports CPU frequency information from the kernel/hardware. The command shows the hardware frequency that the CPU currently runs at, as well as the minimum/maximum CPU frequency allowed, CPUfreq policy/statistics, and so on. To check up on CPU #0:
$ cpufreq-info -c 0
![](https://farm8.staticflickr.com/7484/16094667926_d979240081_c.jpg)
### 3. cpuid ###
The cpuid command-line utility is a dedicated CPU information tool that displays verbose information about CPU hardware by using [CPUID functions][2]. Reported information includes processor type/family, CPU extensions, cache/TLB configuration, power management features, etc.
$ cpuid
![](https://farm9.staticflickr.com/8563/15500753923_6f1b25e8e9_c.jpg)
### 4. dmidecode ###
The dmidecode command collects detailed information about system hardware directly from DMI data of the BIOS. Reported CPU information includes CPU vendor, version, CPU flags, maximum/current clock speed, (enabled) core count, L1/L2/L3 cache configuration, and so on.
$ sudo dmidecode
![](https://farm8.staticflickr.com/7503/16094667836_825b61d0e5_b.jpg)
### 5. hardinfo ###
The hardinfo is a GUI-based system information tool which can give you an easy-to-understand summary of your CPU hardware, as well as other hardware components of your system.
$ hardinfo
![](https://farm8.staticflickr.com/7482/15933041268_40ccc17407_b.jpg)
### 6. i7z ###
i7z is a real-time CPU reporting tool dedicated to Intel Core i3, i5 and i7 CPUs. It can display various per-core information in real time, such as Turbo Boost states, CPU frequencies, CPU power states, temperature measurements, and so on. i7z runs in either ncurses-based console mode or QT based GUI.
$ sudo i7z
![](https://farm8.staticflickr.com/7546/15534687744_1968dc2b18_c.jpg)
### 8. likwid-topology ###
[likwid][3] (Like I Knew What I'm Doing) is a collection of command-line tools to measure, configure and display hardware related properties. Among them is likwid-topology which shows CPU hardware (thread/cache/NUMA) topology information. It can also identify processor families (e.g., Intel Core 2, AMD Shanghai).
![](https://farm8.staticflickr.com/7511/15934711707_5dc0793599_b.jpg)
### 9. lscpu ###
The lscpu command summarizes /etc/cpuinfo content in a more user-friendly format, e.g., the number of (online/offline) CPUs, cores, sockets, NUMA nodes.
$ lscpu
![](https://farm8.staticflickr.com/7501/15933173470_69e53b3021_b.jpg)
### 10. lshw ###
The **lshw** command is a comprehensive hardware query tool. Unlike other tools, lshw requires root privilege because it query DMI information in system BIOS. It can report the total number of cores and enabled cores, but miss out on information such as L1/L2/L3 cache configuration. The GTK version lshw-gtk is also available.
$ sudo lshw -class processor
![](https://farm9.staticflickr.com/8649/15498132484_a47c4e8cb3_c.jpg)
### 11. lstopo ###
The lstopo command (contained in [hwloc][4] package) visualizes the topology of the system which is composed of CPUs, cache, memory and I/O devices. This command is useful to identify the processor architecture and NUMA topology of the system.
$ lstopo
![](https://farm8.staticflickr.com/7490/15934399829_4012213734_z.jpg)
### 12. numactl ###
Originally developed to set the NUMA scheduling and memeory placement policy of Linux processes, the numactl command can also show information about NUMA topology of the CPU hardware from the command line.
$ numactl --hardware
![](https://farm8.staticflickr.com/7553/16094667876_9d7daa77a1_b.jpg)
### 13. x86info ###
x86info is a command-line tool for showing x86-based CPU information. Reported information includes CPU model, number of threads/cores, clock speed, TLB cache configuration, supported feature flags, etc.
$ x86info --all
![](https://farm8.staticflickr.com/7522/16131238626_d8a703c060_c.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/check-cpu-info-linux.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://xmodulo.com/how-to-find-number-of-cpu-cores-on.html
[2]:http://en.wikipedia.org/wiki/CPUID
[3]:http://xmodulo.com/identify-cpu-processor-architecture-linux.html
[4]:http://xmodulo.com/identify-cpu-processor-architecture-linux.html

View File

@ -0,0 +1,157 @@
Linux FAQs with Answers--How to check disk space on Linux with df command
================================================================================
> **Question**: I know I can use df command to check a file system's disk space usage on Linux. Can you show me practical examples of the df command so that I can make the most out of it?
As far as disk storage is concerned, there are many command-line or GUI-based tools that can tell you about current disk space usage. These tools report on detailed disk utilization in various human-readable formats, such as easy-to-understand summary, detailed statistics, or [intuitive visualization][1]. If you simply want to know how much free disk space is available for different file systems, then df command is probably all you need.
![](https://farm9.staticflickr.com/8632/15505309473_51bffec3f1_b.jpg)
The df command can report on disk utilization of any "mounted" file system. There are different ways this command can be invoked. Here are some **useful** df **command examples**.
### Display in Human-Readable Format ###
By default, the df command reports disk space in 1K blocks, which is not easily interpretable. The "-h" parameter will make df print disk space in a more human-readable format (e.g., 100K, 200M, 3G).
$ df -h
----------
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu-root 909G 565G 299G 66% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 3.9G 4.0K 3.9G 1% /dev
tmpfs 785M 1.2M 784M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 63M 3.8G 2% /run/shm
none 100M 48K 100M 1% /run/user
/dev/sda1 228M 98M 118M 46% /boot
### Display Inode Usage ###
When you monitor disk usage, you must watch out for not only disk space, but also "inode" usage. In Linux, inode is a data structure used to store metadata of a particular file, and when a file system is created, a pre-defined number of inodes are allocated. This means that a file system can run out of space not only because big files use up all available space, but also because many small files use up all available inodes. To display inode usage, use "-i" option.
$ df -i
----------
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/ubuntu-root 60514304 1217535 59296769 3% /
none 1004417 13 1004404 1% /sys/fs/cgroup
udev 1000623 552 1000071 1% /dev
tmpfs 1004417 608 1003809 1% /run
none 1004417 11 1004406 1% /run/lock
none 1004417 288 1004129 1% /run/shm
none 1004417 28 1004389 1% /run/user
/dev/sda1 124496 346 124150 1% /boot
### Display Disk Usage Grant Total ###
By default, the df command shows disk utilization of individual file systems. If you want to know the total disk usage over all existing file systems, add "--total" option.
$ df -h --total
----------
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu-root 909G 565G 299G 66% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 3.9G 4.0K 3.9G 1% /dev
tmpfs 785M 1.2M 784M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 62M 3.8G 2% /run/shm
none 100M 48K 100M 1% /run/user
/dev/sda1 228M 98M 118M 46% /boot
total 918G 565G 307G 65% -
### Display File System Types ###
By default, the df command does not show file system type information. Use "-T" option to add file system types to the output.
$ df -T
----------
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/mapper/ubuntu-root ext4 952893348 591583292 312882844 66% /
none tmpfs 4 0 4 0% /sys/fs/cgroup
udev devtmpfs 4002492 4 4002488 1% /dev
tmpfs tmpfs 803536 1196 802340 1% /run
none tmpfs 5120 0 5120 0% /run/lock
none tmpfs 4017668 60176 3957492 2% /run/shm
none tmpfs 102400 48 102352 1% /run/user
/dev/sda1 ext2 233191 100025 120725 46% /boot
### Include or Exclude a Specific File System Type ###
If you want to know free space of a specific file system type, use "-t <type>" option. You can use this option multiple times to include more than one file system types.
$ df -t ext2 -t ext4
----------
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/ubuntu-root 952893348 591583380 312882756 66% /
/dev/sda1 233191 100025 120725 46% /boot
To exclude a specific file system type, use "-x <type>" option. You can use this option multiple times as well.
$ df -x tmpfs
### Display Disk Usage of a Specific Mount Point ###
If you specify a mount point with df, it will report disk usage of the file system mounted at that location. If you specify a regular file (or a directory) instead of a mount point, df will display disk utilization of the file system which contains the file (or the directory).
$ df /
----------
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/ubuntu-root 952893348 591583528 312882608 66% /
----------
$ df /home/dev
----------
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/ubuntu-root 952893348 591583528 312882608 66% /
### Display Information about Dummy File Systems ###
If you want to display disk space information for all existing file systems including dummy file systems, use "-a" option. Here, dummy file systems refer to pseudo file systems which do not have corresponding physical devices, e.g., tmpfs, cgroup virtual file system or FUSE file systems. These dummy filesystems have size of 0, and are not reported by df without "-a" option.
$ df -a
----------
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/ubuntu-root 952893348 591578716 312887420 66% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
none 4 0 4 0% /sys/fs/cgroup
none 0 0 0 - /sys/fs/fuse/connections
none 0 0 0 - /sys/kernel/debug
none 0 0 0 - /sys/kernel/security
udev 4002492 4 4002488 1% /dev
devpts 0 0 0 - /dev/pts
tmpfs 803536 1196 802340 1% /run
none 5120 0 5120 0% /run/lock
none 4017668 58144 3959524 2% /run/shm
none 102400 48 102352 1% /run/user
none 0 0 0 - /sys/fs/pstore
cgroup 0 0 0 - /sys/fs/cgroup/cpuset
cgroup 0 0 0 - /sys/fs/cgroup/hugetlb
/dev/sda1 233191 100025 120725 46% /boot
vmware-vmblock 0 0 0 - /run/vmblock-fuse
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/check-disk-space-linux-df-command.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://xmodulo.com/visualize-disk-usage-linux.html