add chinese for pages.cn/linux/add-apt-respository.md

This commit is contained in:
hugue
2018-12-21 20:04:36 +08:00
committed by Agniva De Sarker
parent 6baf5eaa78
commit 1ce15b00a1
1250 changed files with 26030 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
# add-apt-repository
> apt仓库管理.
- 添加一个新的apt仓库:
`add-apt-repository {{repository_spec}}`
- 移除一个apt仓库:
`add-apt-repository --remove {{repository_spec}}`
- 添加一个仓库并更新缓存:
`add-apt-repository --update {{repository_spec}}`
- 允许从指定仓库下载源码:
`add-apt-repository --enable-source {{repository_spec}}`

23
pages.cn/linux/adduser.md Normal file
View File

@@ -0,0 +1,23 @@
# adduser
> User addition utility.
- Create a new user with a default home directory and prompt the user to set a password:
`adduser {{username}}`
- Create a new user without a home directory:
`adduser --no-create-home {{username}}`
- Create a new user with a home directory at the specified path:
`adduser --home {{path/to/home}} {{username}}`
- Create a new user with the specified shell set as the login shell:
`adduser --shell {{path/to/shell}} {{username}}`
- Create a new user belonging to the specified group:
`adduser --ingroup {{group}} {{username}}`

16
pages.cn/linux/alpine.md Normal file
View File

@@ -0,0 +1,16 @@
# alpine
> An email client and Usenet newsgroup program with a pico/nano-inspired interface.
> Supports most modern email services through IMAP.
- Open alpine normally:
`alpine`
- Open alpine directly to the message composition screen to send an email to a given email address:
`alpine {{email@example.net}}`
- Quit alpine:
`'q' then 'y'`

View File

@@ -0,0 +1,24 @@
# apache2ctl
> The CLI tool to administrate HTTP web server Apache.
> This commmand comes with Debian based OSes, for RHEL based ones see `httpd`.
- Start the Apache daemon. Throw a message if it is already running:
`sudo apache2ctl start`
- Stop the Apache daemon:
`sudo apache2ctl stop`
- Restart the Apache daemon:
`sudo apache2ctl restart`
- Test syntax of the configuration file:
`sudo apache2ctl -t`
- List loaded modules:
`sudo apache2ctl -M`

27
pages.cn/linux/apk.md Normal file
View File

@@ -0,0 +1,27 @@
# apk
> Alpine Linux package management tool.
- Update repository indexes from all remote repositories:
`apk update`
- Install a new package:
`apk add {{package}}`
- Remove a package:
`apk del {{package}}`
- Repair package or upgrade it without modifying main dependencies:
`apk fix {{package}}`
- Search package via keyword:
`apk search {{keyword}}`
- Get info about a specific package:
`apk info {{package}}`

View File

@@ -0,0 +1,23 @@
# apt-cache
> Debian and Ubuntu package query tool.
- Search for a package in your current sources:
`apt-cache search {{query}}`
- Show information about a package:
`apt-cache show {{package}}`
- Show whether a package is installed and up to date:
`apt-cache policy {{package}}`
- Show dependencies for a package:
`apt-cache depends {{package}}`
- Show packages that depend on a particular package:
`apt-cache rdepends {{package}}`

View File

@@ -0,0 +1,15 @@
# apt-file
> Search for files in apt packages, including ones not yet installed.
- Update the metadata database:
`sudo apt update`
- Search for packages that contain the specified file or path:
`apt-file search {{part/of/filename}}`
- List the contents of a specific package:
`apt-file list {{package_name}}`

28
pages.cn/linux/apt-get.md Normal file
View File

@@ -0,0 +1,28 @@
# apt-get
> Debian and Ubuntu package management utility.
> Search for packages using `apt-cache`.
- Update the list of available packages and versions (it's recommended to run this before other `apt-get` commands):
`apt-get update`
- Install a package, or update it to the latest available version:
`apt-get install {{package}}`
- Remove a package:
`apt-get remove {{package}}`
- Upgrade all installed packages to their newest available versions:
`apt-get upgrade`
- Remove all packages that are no longer needed:
`apt-get autoremove`
- Upgrade installed packages (like `upgrade`), but remove obsolete packages and install additional packages to meet new dependencies:
`apt-get dist-upgrade`

23
pages.cn/linux/apt-key.md Normal file
View File

@@ -0,0 +1,23 @@
# apt-key
> Key management utility for the APT Package Manager on Debian and Ubuntu.
- List trusted keys:
`apt-key list`
- Add a key to the trusted keystore:
`apt-key add {{public_key_file.asc}}`
- Delete a key from the trusted keystore:
`apt-key del {{key_id}}`
- Add a remote key to the trusted keystore:
`wget -qO - {{https://host.tld/filename.key}} | apt-key add -`
- Add a key from keyserver with only key id:
`apt-key adv --keyserver {{pgp.mit.edu}} --recv {{KEYID}}`

View File

@@ -0,0 +1,23 @@
# apt-mark
> Utility to change the status of installed packages.
- Mark a package as automatically installed:
`sudo apt-mark auto {{package_name}}`
- Hold a package at its current version and prevent updates to it:
`sudo apt-mark hold {{package_name}}`
- Allow a package to be updated again:
`sudo apt-mark unhold {{package_name}}`
- Show manually installed packages:
`apt-mark showmanual`
- Show held packages that aren't being updated:
`apt-mark showhold`

27
pages.cn/linux/apt.md Normal file
View File

@@ -0,0 +1,27 @@
# apt
> Package management utility for Debian based distributions.
- Update the list of available packages and versions (it's recommended to run this before other `apt` commands):
`sudo apt update`
- Search for a given package:
`apt search {{package}}`
- Show information for a package:
`apt show {{package}}`
- Install a package, or update it to the latest available version:
`sudo apt install {{package}}`
- Remove a package (using `purge` instead also removes its configuration files):
`sudo apt remove {{package}}`
- Upgrade all installed packages to their newest available versions:
`sudo apt upgrade`

View File

@@ -0,0 +1,27 @@
# aptitude
> Debian and Ubuntu package management utility.
- Synchronize list of packages and versions available. This should be run first, before running subsequent aptitude commands:
`aptitude update`
- Install a new package and its dependencies:
`aptitude install {{package}}`
- Search for a package:
`aptitude search {{package}}`
- Remove a package and all packages depending on it:
`aptitude remove {{package}}`
- Upgrade installed packages to newest available versions:
`aptitude upgrade`
- Upgrade installed packages (like `aptitude upgrade`) including removing obsolete packages and installing additional packages to meet new package dependencies:
`aptitude full-upgrade`

8
pages.cn/linux/arch.md Normal file
View File

@@ -0,0 +1,8 @@
# arch
> Display the name of the system architecture.
> See also `uname`.
- Display the system's architecture:
`arch`

7
pages.cn/linux/archey.md Normal file
View File

@@ -0,0 +1,7 @@
# archey
> Simple tool for stylishly displaying system information.
- Show system information:
`archey`

View File

@@ -0,0 +1,19 @@
# arp-scan
> Send ARP packets to hosts (specified as IP addresses or hostnames) to scan the local network.
- Scan the current local network:
`arp-scan --localnet`
- Scan an IP network with a custom bitmask:
`arp-scan {{192.168.1.1}}/{{24}}`
- Scan an IP network within a custom range:
`arp-scan {{127.0.0.0}}-{{127.0.0.31}}`
- Scan an IP network with a custom net mask:
`arp-scan {{10.0.0.0}}:{{255.255.255.0}}`

20
pages.cn/linux/as.md Normal file
View File

@@ -0,0 +1,20 @@
# as
> Portable GNU assembler.
> Primarily intended to assemble output from `gcc` to be used by `ld`.
- Assemble a file, writing the output to a.out:
`as {{file.s}}`
- Assemble the output to a given file:
`as {{file.s}} -o {{out.o}}`
- Generate output faster by skipping whitespace and comment preprocessing. (Should only be used for trusted compilers):
`as -f {{file.s}}`
- Include a given path to the list of directories to search for files specified in .include directives:
`as -I {{path/to/directory}} {{file.s}}`

23
pages.cn/linux/aspell.md Normal file
View File

@@ -0,0 +1,23 @@
# aspell
> Interactive spell checker.
- Spell check a single file:
`aspell check {{path/to/file}}`
- List mispelled words from standard input:
`cat {{file}} | aspell list`
- Show available dictionary languages:
`aspell dicts`
- Run aspell with different language (takes two letter ISO 639 language code):
`aspell --lang={{cs}}`
- List mispelled words from standard input and ignore words from personal word list:
`cat {{file}} | aspell --personal={{personal-word-list.pws}} {{list}}`

15
pages.cn/linux/at.md Normal file
View File

@@ -0,0 +1,15 @@
# at
> Executes commands at a specified time.
- Open an `at` prompt to create a new set of scheduled commands, press `Ctrl + D` to save and exit:
`at {{hh:mm:ss}}`
- Execute the commands and email the result using a local mailing program such as sendmail:
`at {{hh:mm:ss}} -m`
- Execute a script at the given time:
`at {{hh:mm:ss}} -f {{path/to/file}}`

View File

@@ -0,0 +1,35 @@
# authconfig
> A CLI interface for configuring system authentication resources.
- Display the current configuration (or dry run):
`authconfig --test`
- Configure the server to use a different password hashing algorithm:
`authconfig --update --passalgo={{algorithm}}`
- Enable LDAP authentication:
`authconfig --update --enableldapauth`
- Disable LDAP authentication:
`authconfig --update --disableldapauth`
- Enable Network Information Service (NIS):
`authconfig --update --enablenis`
- Enable Kerberos:
`authconfig --update --enablekrb5`
- Enable Winbind (Active Directory) authentication:
`authconfig --update --enablewinbindauth`
- Enable local authorization:
`authconfig --update --enablelocauthorize`

View File

@@ -0,0 +1,19 @@
# autorandr
> Automatically change screen layout.
- Save the current screen layout:
`autorandr -s {{profile_name}}`
- Show the saved profiles:
`autorandr`
- Change the profile:
`autorandr -l {{profile_name}}`
- Set the default profile:
`autorandr -d {{profile_name}}`

23
pages.cn/linux/beep.md Normal file
View File

@@ -0,0 +1,23 @@
# beep
> A utility to beep the PC speaker.
- Play a beep:
`beep`
- Play a beep that repeats:
`beep -r {{repetitions}}`
- Play a beep at a specified frequency (Hz) and duration (milliseconds):
`beep -f {{frequency}} -l {{duration}}`
- Play each new frequency and duration as a distinct beep:
`beep -f {{frequency}} -l {{duration}} -n -f {{frequency}} -l {{duration}}`
- Play the C major scale:
`beep -f 262 -n -f 294 -n -f 330 -n -f 349 -n -f 392 -n -f 440 -n -f 494 -n -f 523`

19
pages.cn/linux/bmon.md Normal file
View File

@@ -0,0 +1,19 @@
# bmon
> Monitor bandwidth and capture network related statistics.
- Display the list of all the interfaces:
`bmon -a`
- Display data transfer rates in bits per second:
`bmon -b`
- Set policy to define which network interface(s) is/are displayed:
`bmon -p {{interface_1,interface_2,interface_3}}`
- Set interval (in seconds) in which rate per counter is calculated:
`bmon -R {{2.0}}`

35
pages.cn/linux/brew.md Normal file
View File

@@ -0,0 +1,35 @@
# brew
> The Homebrew package manager for Linux.
- Search for available formulas:
`brew search {{text}}`
- Install the latest stable version of a formula (use `--devel` for development versions):
`brew install {{formula}}`
- List all installed formulae:
`brew list`
- Update an installed formula (if no formula name is given, all installed formulae are updated):
`brew upgrade {{formula}}`
- Fetch the newest version of Linuxbrew and all formulae from GitHub:
`brew update`
- Show formulae that have a more recent version available:
`brew outdated`
- Display information about a formula (version, installation path, dependencies, etc.):
`brew info {{formula}}`
- Check your Linuxbrew installation for potential problems:
`brew doctor`

15
pages.cn/linux/bzip2.md Normal file
View File

@@ -0,0 +1,15 @@
# bzip2
> A block-sorting file compressor.
- Compress file:
`bzip2 {{path/to/file_to_compress}}`
- Decompress file:
`bzip2 -d {{path/to/compressed_file.bz2}}`
- Decompress to console:
`bzip2 -dc {{path/to/compressed_file.bz2}}`

23
pages.cn/linux/cal.md Normal file
View File

@@ -0,0 +1,23 @@
# cal
> Prints calendar information, with the current day highlighted.
- Display a calendar for the current month:
`cal`
- Display previous, current and next month:
`cal --three`
- Use monday as the first day of the week:
`cal --monday`
- Display a calendar for a specific year (4 digits):
`cal {{year}}`
- Display a calendar for a specific month and year:
`cal {{month}} {{year}}`

11
pages.cn/linux/calc.md Normal file
View File

@@ -0,0 +1,11 @@
# calc
> An interactive arbitrary-precision calculator on the terminal.
- Start calc in interactive mode:
`calc`
- Perform a calculation in non-interactive mode:
`calc -p '{{85 * (36 / 4)}}'`

28
pages.cn/linux/certbot.md Normal file
View File

@@ -0,0 +1,28 @@
# certbot
> The Let's Encrypt Agent for automatically obtaining and renewing TLS certificates.
> Successor to `letsencrypt`.
- Obtain a new certificate via webroot authorization, but do not install it automatically:
`sudo certbot certonly --webroot --webroot-path {{path/to/webroot}} --domain {{subdomain.example.com}}`
- Obtain a new certificate via nginx authorization, installing the new certificate automatically:
`sudo certbot --nginx --domain {{subdomain.example.com}}`
- Obtain a new certificate via apache authorization, installing the new certificate automatically:
`sudo certbot --apache --domain {{subdomain.example.com}}`
- Renew all Let's Encrypt certificates that expire in 30 days or less (don't forget to restart any servers that use them afterwards):
`sudo certbot renew`
- Simulate the obtaining of a new certificate, but don't actually save any new certificates to disk:
`sudo certbot --webroot --webroot-path {{path/to/webroot}} --domain {{subdomain.example.com}} --dry-run`
- Obtain an untrusted test certificate instead:
`sudo certbot --webroot --webroot-path {{path/to/webroot}} --domain {{subdomain.example.com}} --test-cert`

23
pages.cn/linux/chage.md Normal file
View File

@@ -0,0 +1,23 @@
# chage
> Change user account and password expiry information.
- List password information for the user:
`chage -l {{user_name}}`
- Enable password expiration in 10 days:
`sudo chage -M {{10}} {{user_name}}`
- Disable password expiration:
`sudo chage -M -1 {{user_name}}`
- Set account expiration date:
`sudo chage -E {{YYYY-MM-DD}}`
- Force user to change password on next log in:
`sudo chage -d 0`

15
pages.cn/linux/chattr.md Normal file
View File

@@ -0,0 +1,15 @@
# chattr
> Change attributes of files or folders.
- Make a file or folder immutable to changes and deletion, even by superuser:
`chattr +i {{path}}`
- Make a file or folder mutable:
`chattr -i {{path}}`
- Recursively make an entire folder and contents immutable:
`chattr -R +i {{folder}}`

View File

@@ -0,0 +1,27 @@
# chkconfig
> Manage the runlevel of services on CentOS 6.
- List services with runlevel:
`chkconfig --list`
- Show a service's runlevel:
`chkconfig --list {{ntpd}}`
- Enable service at boot:
`chkconfig {{sshd}} on`
- Enable service at boot for runlevels 2, 3, 4, and 5:
`chkconfig --level {{2345}} {{sshd}} on`
- Disable service at boot:
`chkconfig {{ntpd}} off`
- Disable service at boot for runlevel 3:
`chkconfig --level {{3}} {{ntpd}} off`

24
pages.cn/linux/cmus.md Normal file
View File

@@ -0,0 +1,24 @@
# cmus
> Commandline Music Player.
> Use arrow keys to navigate, `<enter/return>` to select, and numbers 1-8 switch between different views.
- Open cmus from specified directory:
`cmus {{path/to/directory}}`
- Add file/directory to library:
`:add {{path/to/file_or_directory}}`
- Pause/unpause current song:
`c`
- Toggle shuffle mode on/off:
`s`
- Quit cmus:
`q`

View File

@@ -0,0 +1,7 @@
# command
> Command forces the shell to execute the program and ignore any functions, builtins and aliases with the same name.
- Execute the ls program literally, even if an ls alias exists:
`command {{ls}}`

23
pages.cn/linux/compgen.md Normal file
View File

@@ -0,0 +1,23 @@
# compgen
> A built-in command for auto-completion in bash, which is called on pressing TAB key twice.
- List all commands that you could run:
`compgen -c`
- List all aliases:
`compgen -a`
- List all functions that you could run:
`compgen -A function`
- Show shell reserved key words:
`compgen -k`
- See all available commands/aliases starting with 'ls':
`compgen -ac {{ls}}`

12
pages.cn/linux/compose.md Normal file
View File

@@ -0,0 +1,12 @@
# compose
> An alias to a `run-mailcap`'s action compose.
> Originally `run-mailcap` is used to mime-type/file.
- Compose action can be used to compose any existing file or new on default mailcap edit tool:
`compose {{filename}}`
- With `run-mailcap`:
`run-mailcap --action=compose {{filename}}`

27
pages.cn/linux/conky.md Normal file
View File

@@ -0,0 +1,27 @@
# conky
> Light-weight system monitor for X.
- Launch with default, built-in config:
`conky`
- Create a new default config:
`conky -C > ~/.conkyrc`
- Launch conky with a given config file:
`conky -c {{path/to/config}}`
- Start in the background (daemonize):
`conky -d`
- Align conky on the desktop:
`conky -a {{{top,bottom,middle}_{left,right,middle}}}`
- Pause for 5 seconds at startup before launching:
`conky -p {{5}}`

View File

@@ -0,0 +1,20 @@
# cpufreq-aperf
> Calculate the average CPU frequency over a time period.
> Requires root privileges.
- Start calculating, defaulting to all CPU cores and 1 second refresh interval:
`sudo cpufreq-aperf`
- Start calculating for CPU 1 only:
`sudo cpufreq-aperf -c {{1}}`
- Start calculating with a 3 seconds refresh interval for all CPU cores:
`sudo cpufreq-aperf -i {{3}}`
- Calculate only once:
`sudo cpufreq-aperf -o`

View File

@@ -0,0 +1,31 @@
# cpufreq-info
> A tool to show CPU frequency information.
- Show CPU frequency information for all CPUs:
`cpufreq-info`
- Show CPU frequency information for the specified CPU:
`cpufreq-info -c {{cpu_number}}`
- Show the allowed minimum and maximum CPU frequency:
`cpufreq-info -l`
- Show the current minimum and maximum CPU frequency and policy in table format:
`cpufreq-info -o`
- Show available CPU frequency policies:
`cpufreq-info -g`
- Show current CPU work frequency in a human-readable format, according to the cpufreq kernel module:
`cpufreq-info -f -m`
- Show current CPU work frequency in a human-readable format, by reading it from hardware (only available to root):
`sudo cpufreq-info -w -m`

View File

@@ -0,0 +1,20 @@
# cpufreq-set
> A tool to modify CPU frequency settings.
> The frequency value should range between the output of command `cpufreq-info -l`.
- Set the CPU frequency policy of CPU 1 to "userspace":
`sudo cpufreq-set -c {{1}} -g {{userspace}}`
- Set the current minimum CPU frequency of CPU 1:
`sudo cpufreq-set -c {{1}} --min {{min_frequency}}`
- Set the current maximum CPU frequency of CPU 1:
`sudo cpufreq-set -c {{1}} --max {{max_frequency}}`
- Set the current work frequency of CPU 1:
`sudo cpufreq-set -c {{1}} -f {{work_frequency}}`

15
pages.cn/linux/cpuid.md Normal file
View File

@@ -0,0 +1,15 @@
# cpuid
> Display detailed information about all CPUs.
- Display information for all CPUs:
`cpuid`
- Display information only for the current CPU:
`cpuid -1`
- Display raw hex information with no decoding:
`cpuid -r`

View File

@@ -0,0 +1,19 @@
# cryptsetup
> Manage plain dm-crypt and LUKS (Linux Unified Key Setup) encrypted volumes.
- Initialize a LUKS volume (overwrites all data on the partition):
`cryptsetup luksFormat {{/dev/sda1}}`
- Open a LUKS volume and create a decrypted mapping at /dev/mapper/{{target}}:
`cryptsetup luksOpen {{/dev/sda1}} {{target}}`
- Remove an existing mapping:
`cryptsetup luksClose {{target}}`
- Change the LUKS volume's passphrase:
`cryptsetup luksChangeKey {{/dev/sda1}}`

24
pages.cn/linux/csplit.md Normal file
View File

@@ -0,0 +1,24 @@
# csplit
> Split a file into pieces.
> This generates files named "xx00", "xx01", and so on.
- Split a file at lines 5 and 23:
`csplit {{file}} {{5}} {{23}}`
- Split a file every 5 lines (this will fail if the total number of lines is not divisible by 5):
`csplit {{file}} {{5}} {*}`
- Split a file every 5 lines, ignoring exact-division error:
`csplit -k {{file}} {{5}} {*}`
- Split a file at line 5 and use a custom prefix for the output files:
`csplit {{file}} {{5}} -f {{prefix}}`
- Split a file at a line matching a regular expression:
`csplit {{file}} /{{regex}}/`

20
pages.cn/linux/dash.md Normal file
View File

@@ -0,0 +1,20 @@
# dash
> Debian Almquist Shell.
> Modern POSIX-compliant implementation of `sh` (isn't Bash compatible).
- Start interactive shell:
`dash`
- Execute a command:
`dash -c "{{command}}"`
- Run commands from a file:
`dash {{file.sh}}`
- Run commands from a file, logging all commands executed to the terminal:
`dash -x {{file.sh}}`

View File

@@ -0,0 +1,19 @@
# datamash
> Tool to perform basic numeric, textual and statistical operations on input textual data files.
- Get max, min, mean and median of a single column of numbers:
`seq 3 | datamash max 1 min 1 mean 1 median 1`
- Get the mean of a single column of float numbers (floats must use "," and not "."):
`echo -e '1.0\n2.5\n3.1\n4.3\n5.6\n5.7' | tr '.' ',' | datamash mean 1`
- Get the mean of a single column of numbers with a given decimal precision:
`echo -e '1\n2\n3\n4\n5\n5' | datamash -R {{number_of_decimals_wanted}} mean 1`
- Get the mean of a single column of numbers ignoring "Na" and "NaN" (literal) strings:
`echo -e '1\n2\nNa\n3\nNaN' | datamash --narm mean 1`

View File

@@ -0,0 +1,27 @@
# dbus-daemon
> The D-Bus message daemon, allowing multiple programs to exchange messages.
- Run the daemon with a configuration file:
`dbus-daemon --config-file {{path/to/file}}`
- Run the daemon with the standard per-login-session message bus configuration:
`dbus-daemon --session`
- Run the daemon with the standard systemwide message bus configuration:
`dbus-daemon --system`
- Set the address to listen on and override the configuration value for it:
`dbus-daemon --address {{address}}`
- Output the process id to stdout:
`dbus-daemon --print-pid`
- Force the message bus to write to the system log for messages:
`dbus-daemon --syslog`

11
pages.cn/linux/diff3.md Normal file
View File

@@ -0,0 +1,11 @@
# diff3
> Compare three files line by line.
- Compare files:
`diff3 {{file1}} {{file2}} {{file3}}`
- Show all changes, outlining conflicts:
`diff3 --show-all {{file1}} {{file2}} {{file3}}`

16
pages.cn/linux/disown.md Normal file
View File

@@ -0,0 +1,16 @@
# disown
> Allow sub-processes to live beyond the shell that they are attached to.
> See also the `jobs` command.
- Disown the current job:
`disown`
- Disown a specific job:
`disown %{{job_number}}`
- Disown all jobs:
`disown -a`

23
pages.cn/linux/dmesg.md Normal file
View File

@@ -0,0 +1,23 @@
# dmesg
> Write the kernel messages to standard output.
- Show kernel messages:
`dmesg`
- Show kernel error messages:
`dmesg --level err`
- Show kernel messages and keep reading new ones, similar to `tail -f` (available in kernels 3.5.0 and newer):
`dmesg -w`
- Show how much physical memory is available on this system:
`dmesg | grep -i memory`
- Show kernel messages 1 page at a time:
`dmesg | less`

View File

@@ -0,0 +1,28 @@
# dmidecode
> Display the DMI (alternatively known as SMBIOS) table contents in a human-readable format.
> Requires root privileges.
- Show all DMI table contents:
`sudo dmidecode`
- Show the BIOS version:
`sudo dmidecode -s bios-version`
- Show the system's serial number:
`sudo dmidecode -s system-serial-number`
- Show BIOS information:
`sudo dmidecode -t bios`
- Show CPU information:
`sudo dmidecode -t processor`
- Show memory information:
`sudo dmidecode -t memory`

19
pages.cn/linux/dnf.md Normal file
View File

@@ -0,0 +1,19 @@
# dnf
> Package management utility for RHEL, Fedora, and CentOS (replaces yum).
- Install a new package:
`sudo dnf install {{package}}`
- Install a new package and assume yes to all questions:
`sudo dnf -y install {{package}}`
- Remove a package:
`sudo dnf remove {{package}}`
- Upgrade installed packages to newest available versions:
`sudo dnf upgrade`

View File

@@ -0,0 +1,19 @@
# dpkg-query
> A tool that shows information about installed packages.
- List all installed packages:
`dpkg-query -l`
- List installed packages matching a pattern:
`dpkg-query -l '{{pattern}}'`
- List all files installed by a package:
`dpkg-query -L {{package_name}}`
- Show information about a package:
`dpkg-query -s {{package_name}}`

27
pages.cn/linux/dpkg.md Normal file
View File

@@ -0,0 +1,27 @@
# dpkg
> Debian package manager.
- Install a package:
`dpkg -i {{path/to/file.deb}}`
- Remove a package:
`dpkg -r {{package_name}}`
- List installed packages:
`dpkg -l {{pattern}}`
- List package contents:
`dpkg -L {{package_name}}`
- List contents of a local package file:
`dpkg -c {{path/to/file.deb}}`
- Find out which package owns a file:
`dpkg -S {{file_name}}`

35
pages.cn/linux/ebuild.md Normal file
View File

@@ -0,0 +1,35 @@
# ebuild
> A low level interface to the Gentoo Portage system.
- Create or update the package manifest:
`ebuild {{path/to/file.ebuild}} manifest`
- Clean the temporary build directories for the build file:
`ebuild {{path/to/file.ebuild}} clean`
- Fetch sources if they do not exist:
`ebuild {{path/to/file.ebuild}} fetch`
- Extract the sources to a temporary build directory:
`ebuild {{path/to/file.ebuild}} unpack`
- Compile the extracted sources:
`ebuild {{path/to/file.ebuild}} compile`
- Install the package to a temporary install directory:
`ebuild {{path/to/file.ebuild}} install`
- Install the temporary files to the live filesystem:
`ebuild {{path/to/file.ebuild}} qmerge`
- Fetch, unpack, compile, install and qmerge the specified ebuild file:
`ebuild {{path/to/file.ebuild}} merge`

12
pages.cn/linux/edit.md Normal file
View File

@@ -0,0 +1,12 @@
# edit
> An alias to a `run-mailcap`'s action edit.
> Originally `run-mailcap` is used to process/edit mime-type/file.
- Edit action can be used to view any file on default mailcap explorer:
`edit {{filename}}`
- With `run-mailcap`:
`run-mailcap --action=edit {{filename}}`

28
pages.cn/linux/edquota.md Normal file
View File

@@ -0,0 +1,28 @@
# edquota
> Edit quotas for a user or group. By default it operates on all file systems with quotas.
> Quota information is stored permanently in the `quota.user` and `quota.group` files in the root of the filesystem.
- Edit quota of the current user:
`edquota --user $(whoami)`
- Edit quota of a specific user:
`sudo edquota --user {{username}}`
- Edit quota for a group:
`sudo edquota --group {{group}}`
- Restrict operations to a given filesystem (by default edquota operates on all filesystems with quotas):
`sudo edquota --file-system {{filesystem}}`
- Edit the default grace period:
`sudo edquota -t`
- Duplicate a quota to other users:
`sudo edquota -p {{reference_user}} {{destination_user1}} {{destination_user2}}`

31
pages.cn/linux/eject.md Normal file
View File

@@ -0,0 +1,31 @@
# eject
> Eject cds, floppy disks and tape drives.
- Display the default device:
`eject -d`
- Eject the default device:
`eject`
- Eject a specific device (the default order is cd-rom, scsi, floppy and tape):
`eject {{/dev/cdrom}}`
- Toggle whether a device's tray is open or closed:
`eject -T {{/dev/cdrom}}`
- Eject a cd drive:
`eject -r {{/dev/cdrom}}`
- Eject a floppy drive:
`eject -f {{/mnt/floppy}}`
- Eject a tape drive:
`eject -q {{/mnt/tape}}`

31
pages.cn/linux/emerge.md Normal file
View File

@@ -0,0 +1,31 @@
# emerge
> Gentoo Linux package manager utility.
- Synchronize all packages:
`emerge --sync`
- Update all packages, including dependencies:
`emerge -uDNav @world`
- Resume a failed updated, skipping the failing package:
`emerge --resume --skipfirst`
- Install a new package, with confirmation:
`emerge -av {{package_name}}`
- Remove a package, with confirmation:
`emerge -Cav {{package_name}}`
- Remove orphaned packages (that were installed only as dependencies):
`emerge -avc`
- Search the package database for a keyword:
`emerge -S {{keyword}}`

19
pages.cn/linux/entr.md Normal file
View File

@@ -0,0 +1,19 @@
# entr
> Run arbitrary commands when files change.
- Rebuild with `make` if any files in any subfolders change:
`{{ag -l}} | entr {{make}}`
- Rebuild and test with `make` if any `.c` source files in the current directory change:
`{{ls *.c}} | entr {{'make && make test'}}`
- Send a `SIGTERM` to any previously spawned ruby subprocesses before executing `ruby main.rb`:
`{{ls *.rb}} | entr -r {{ruby main.rb}}`
- Run a command with the changed file (`/_`) as an argument:
`{{ls *.sql}} | entr {{psql -f}} /_`

View File

@@ -0,0 +1,20 @@
# envsubst
> Substitutes shell format strings with environment variables in text.
> Strings to be replaced should be in either `${var}` or `$var` format.
- Replace environment variables in stdin and output to stdout:
`echo '{{$HOME}}' | envsubst`
- Replace environment variables in an input file and output to stdout:
`envsubst < {{path/to/input}}`
- Replace environment variables in an input file and output to a file:
`envsubst < {{path/to/input}} > {{path/to/output}}`
- Replace environment variables in input from a space-separated list:
`envsubst {{variables}} < {{path/to/input}}`

23
pages.cn/linux/equery.md Normal file
View File

@@ -0,0 +1,23 @@
# equery
> View information about Portage packages.
- List all installed packages:
`equery list '*'`
- Search for installed packages in the Portage tree and in overlays:
`equery list -po {{package_name}}`
- List all packages that depend on a given package:
`equery depends {{package_name}}`
- List all packages that a given package depends on:
`equery depgraph {{package_name}}`
- List all files installed by a package:
`equery files --tree {{package_name}}`

11
pages.cn/linux/eval.md Normal file
View File

@@ -0,0 +1,11 @@
# eval
> Execute arguments as a single command in the current shell and return its result.
- Call `echo` with the "foo" argument:
`eval "{{echo foo}}"`
- Set a variable in the current shell:
`eval "{{foo=bar}}"`

19
pages.cn/linux/export.md Normal file
View File

@@ -0,0 +1,19 @@
# export
> Command to mark shell variables in the current environment to be exported with any newly forked child processes.
- Set a new environment variable:
`export {{VARIABLE}}={{value}}`
- Remove an environment variable:
`export -n {{VARIABLE}}`
- Mark a shell function for export:
`export -f {{FUNCTION_NAME}}`
- Append something to the PATH variable:
`export PATH=$PATH:{{path/to/append}}`

19
pages.cn/linux/eyeD3.md Normal file
View File

@@ -0,0 +1,19 @@
# eyeD3
> Read and manipulate metadata of MP3 files.
- View information about an MP3 file:
`eyeD3 {{filename.mp3}}`
- Set the title of an MP3 file:
`eyeD3 --title {{"A Title"}} {{filename.mp3}}`
- Set the album of all the MP3 files in a directory:
`eyeD3 --album {{"Album Name"}} {{*.mp3}}`
- Set the front cover art for an MP3 file:
`eyeD3 --add-image {{front_cover.jpeg}}:FRONT_COVER: {{filename.mp3}}`

23
pages.cn/linux/f5fpc.md Normal file
View File

@@ -0,0 +1,23 @@
# f5fpc
> A proprietry commercial SSL VPN client by BIG-IP Edge.
- Open a new VPN connection:
`sudo f5fpc --start`
- Open a new VPN connection to a specific host:
`sudo f5fpc --start --host {{host.example.com}}`
- Specify a username (user will be prompted for a password):
`sudo f5fpc --start --host {{host.example.com}} --username {{user}}`
- Show the current VPN status:
`sudo f5fpc --info`
- Shutdown the VPN connection:
`sudo f5fpc --stop`

View File

@@ -0,0 +1,16 @@
# fallocate
> Reserve or deallocate disk space to files.
> The utility allocates space without zeroing.
- Reserve a file taking up 700MB of disk space:
`fallocate --length {{700M}} {{path/to/file}}`
- Shrink an already allocated file by 200MB:
`fallocate --collapse-range --length {{200M}} {{path/to/file}}`
- Shrink 20MB of space after 100MB in a file:
`fallocate --collapse-range --offset {{100M}} --length {{20M}} {{path/to/file}}`

View File

@@ -0,0 +1,11 @@
# fatlabel
> Sets or gets the label of a FAT32 partition.
- Get the label of a FAT32 partition:
`fatlabel {{/dev/sda1}}`
- Set the label of a FAT32 partition:
`fatlabel {{/dev/sdc3}} "{{new_label}}"`

View File

@@ -0,0 +1,7 @@
# fc-list
> List available fonts installed on the system.
- Return a list of installed fonts with given name:
`fc-list | grep '{{DejaVu Serif}}'`

View File

@@ -0,0 +1,7 @@
# fc-match
> Match available fonts.
- Return a sorted list of best matching fonts:
`fc-match -s '{{DejaVu Serif}}'`

View File

@@ -0,0 +1,7 @@
# fc-pattern
> Shows information about a font matching a pattern.
- Display default information about a font:
`fc-pattern -d '{{DejaVu Serif}}'`

15
pages.cn/linux/fc.md Normal file
View File

@@ -0,0 +1,15 @@
# fc
> Open the most recent command and edit it.
- Open in the default system editor:
`fc`
- Specify an editor to open with:
`fc -e {{'emacs'}}`
- List recent commands from history:
`fc -l`

11
pages.cn/linux/fdisk.md Normal file
View File

@@ -0,0 +1,11 @@
# fdisk
> A program for managing partition tables and partitions on a hard disk.
- List partitions:
`fdisk -l`
- Start the partition manipulator:
`fdisk {{/dev/sda}}`

27
pages.cn/linux/feh.md Normal file
View File

@@ -0,0 +1,27 @@
# feh
> Lightweight image viewing utility.
- View images locally or using a URL:
`feh {{path/to/images}}`
- View images recursively:
`feh --recursive {{path/to/images}}`
- View images without window borders:
`feh --borderless {{path/to/images}}`
- Exit after the last image:
`feh --cycle-once {{path/to/images}}`
- Set the slideshow cycle delay:
`feh --slideshow-delay {{seconds}} {{path/to/images}}`
- Set your wallpaper (centered, filled, maximized, scaled or tiled):
`feh --bg-{{center|fill|max|scale|tile}} {{path/to/image}}`

19
pages.cn/linux/figlet.md Normal file
View File

@@ -0,0 +1,19 @@
# figlet
> Generate ASCII banners from user input.
- Generate by directly inputting text:
`figlet {{input_text}}`
- Use a custom font file:
`figlet {{input_text}} -f {{font_file_name}}`
- Pipe command output through figlet:
`{{command}} | figlet`
- Show available figlet fonts:
`showfigfonts {{optional_string_to_display}}`

23
pages.cn/linux/file.md Normal file
View File

@@ -0,0 +1,23 @@
# file
> Determine file type.
- Give a description of the type of the specified file. Works fine for files with no file extension:
`file {{filename}}`
- Look inside a zipped file and determine the file type(s) inside:
`file -z {{foo.zip}}`
- Allow file to work with special or device files:
`file -s {{filename}}`
- Don't stop at first file type match; keep going until the end of the file:
`file -k {{filename}}`
- Determine the mime encoding type of a file:
`file -i {{filename}}`

23
pages.cn/linux/findmnt.md Normal file
View File

@@ -0,0 +1,23 @@
# findmnt
> Find your filesystem.
- List all mounted filesystems:
`findmnt`
- Search for a device:
`findmnt {{/dev/sdb1}}`
- Search for a mountpoint:
`findmnt {{/}}`
- Find filesystems in specific type:
`findmnt -t {{ext4}}`
- Find filesystems with specific label:
`findmnt LABEL={{BigStorage}}`

View File

@@ -0,0 +1,27 @@
# firejail
> Securely sandboxes processes to containers using built-in Linux capabilities.
- Integrate firejail with your desktop environment:
`sudo firecfg`
- Open a restricted Mozilla Firefox:
`firejail {{firefox}}`
- Start a restricted Apache server on a known interface and address:
`firejail --net={{eth0}} --ip={{192.168.1.244}} {{/etc/init.d/apache2}} {{start}}`
- List running sandboxes:
`firejail --list`
- List network activity from running sandboxes:
`firejail --netstats`
- Shutdown a running sandbox:
`firejail --shutdown={{7777}}`

View File

@@ -0,0 +1,23 @@
# firewall-cmd
> The firewalld command line client.
- View the available firewall zones:
`firewall-cmd --get-active-zones`
- View the rules which are currently applied:
`firewall-cmd --list-all`
- Permanently open the port for a service in the specified zone (like port `443` when in the `public` zone):
`firewall-cmd --permanent --zone={{public}} --add-service={{https}}`
- Permanently close the port for a service in the specified zone (like port `80` when in the `public` zone):
`firewall-cmd --permanent --zone={{public}} --remove-service={{http}}`
- Reload firewalld to force rule changes to take effect:
`firewall-cmd --reload`

27
pages.cn/linux/flatpak.md Normal file
View File

@@ -0,0 +1,27 @@
# flatpak
> Build, install and run flatpak applications and runtimes.
- Run an installed application:
`flatpak run {{name}}`
- Install an application from a remote source:
`flatpak install {{remote}} {{name}}`
- List all installed applications and runtimes:
`flatpak list`
- Update all installed applications and runtimes:
`flatpak update`
- Add a remote source:
`flatpak remote-add --if-not-exists {{remote_name}} {{remote_url}}`
- List all configured remote sources:
`flatpak remote-list`

27
pages.cn/linux/foreman.md Normal file
View File

@@ -0,0 +1,27 @@
# foreman
> Manage Procfile-based applications.
- Start an application with the Procfile in the current directory:
`foreman start`
- Start an application with a specified Procfile:
`foreman start -f {{Procfile}}`
- Start a specific application:
`foreman start {{process}}`
- Validate Procfile format:
`foreman check`
- Run one-off commands with the process's environment:
`foreman run {{command}}`
- Start all processes except the one named "worker":
`foreman start -m all=1,{{worker}}=0`

19
pages.cn/linux/free.md Normal file
View File

@@ -0,0 +1,19 @@
# free
> Display amount of free and used memory in the system.
- Display system memory:
`free`
- Display memory in Bytes/KB/MB/GB:
`free -{{b|k|m|g}}`
- Display memory in human readable units:
`free -h`
- Refresh the output every 2 seconds:
`free -s {{2}}`

15
pages.cn/linux/fsck.md Normal file
View File

@@ -0,0 +1,15 @@
# fsck
> Check the integrity of a filesystem or repair it. The filesystem should be unmounted at the time the command is run.
- Check filesystem /dev/sda, reporting any damaged blocks:
`fsck {{/dev/sda}}`
- Check filesystem /dev/sda, reporting any damaged blocks and interactively letting the user choose to repair each one:
`fsck -r {{/dev/sda}}`
- Check filesystem /dev/sda, reporting any damaged blocks and automatically repairing them:
`fsck -a {{/dev/sda}}`

8
pages.cn/linux/fuser.md Normal file
View File

@@ -0,0 +1,8 @@
# fuser
> Display process IDs currently using files or sockets.
> Require admin privileges.
- Identify process using a TCP socket:
`fuser -n tcp {{port}}`

View File

@@ -0,0 +1,23 @@
# genkernel
> Gentoo Linux utility to compile and install kernels.
- Automatically compile and install a generic kernel:
`sudo genkernel all`
- Build and install the bzImage|initramfs|kernel|ramdisk only:
`sudo genkernel {{bzImage|initramfs|kernel|ramdisk}}`
- Apply changes to the kernel configuration before compiling and installing:
`sudo genkernel --menuconfig all`
- Generate a kernel with a custom name:
`sudo genkernel --kernname={{custom_name}} all`
- Use a kernel source outside of the default directory /usr/src/linux:
`sudo genkernel --kerneldir={{path/to/directory}} all`

23
pages.cn/linux/getent.md Normal file
View File

@@ -0,0 +1,23 @@
# getent
> Get entries from Name Service Switch libraries.
- Get list of all groups:
`getent group`
- See the members of a group:
`getent group {{group_name}}`
- Get list of all services:
`getent services`
- Find a username by UID:
`getent passwd 1000`
- Perform a reverse DNS lookup:
`getent hosts {{host}}`

15
pages.cn/linux/getfacl.md Normal file
View File

@@ -0,0 +1,15 @@
# getfacl
> Get file access control lists.
- Display the file access control list:
`getfacl {{path/to/file_or_folder}}`
- Display the file access control list with numeric user and group IDs:
`getfacl -n {{path/to/file_or_folder}}`
- Display the file access control list with tabular output format:
`getfacl -t {{path/to/file_or_folder}}`

View File

@@ -0,0 +1,19 @@
# gnome-terminal
> The GNOME Terminal emulator.
- Open a new GNOME terminal window:
`gnome-terminal`
- Run a specific command in a new terminal window:
`gnome-terminal -- {{command}}`
- Open a new tab in the last opened window instead:
`gnome-terminal --tab`
- Set the title of the new tab:
`gnome-terminal --tab --title "{{title}}"`

23
pages.cn/linux/gpasswd.md Normal file
View File

@@ -0,0 +1,23 @@
# gpasswd
> Administer "/etc/group" and "/etc/gshadow".
- Define group administrators:
`sudo gpasswd -A {{user1,user2}} {{group}}`
- Set the list of group members:
`sudo gpasswd -M {{user1,user2}} {{group}}`
- Create a password for the named group:
`gpasswd {{group}}`
- Add a user to the named group:
`gpasswd -a {{user}} {{group}}`
- Remove a user from the named group:
`gpasswd -d {{user}} {{group}}`

View File

@@ -0,0 +1,11 @@
# groupadd
> Add user groups to the system.
- Create a new Linux group:
`groupadd {{group_name}}`
- Create new group with a specific groupid:
`groupadd {{group_name}} -g {{group_id}}`

View File

@@ -0,0 +1,7 @@
# groupdel
> Delete existing user groups from the system.
- Delete an existing group:
`groupdel {{group_name}}`

View File

@@ -0,0 +1,11 @@
# groupmod
> Modify existing user groups in the system.
- Change the group name:
`groupmod -n {{new_group_name}} {{old_group_name}}`
- Change the group id:
`groupmod -g {{new_group_id}} {{old_group_name}}`

27
pages.cn/linux/gs.md Normal file
View File

@@ -0,0 +1,27 @@
# gs
> GhostScript is a PDF and PostScript interpreter.
- To view a file:
`gs -dQUIET -dBATCH {{file.pdf}}`
- Reduce PDF file size to 150 dpi images for reading on a ebook device:
`gs -dNOPAUSE -dQUIET -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -sOutputFile={{output.pdf}} {{input.pdf}}`
- Convert PDF file (pages 1 through 3) to an image with 150 dpi resolution:
`gs -dQUIET -dBATCH -dNOPAUSE -sDEVICE=jpeg -r150 -dFirstPage={{1}} -dLastPage={{3}} -sOutputFile={{output_%d.jpg}} {{input.pdf}}`
- Extract pages from a PDF file:
`gs -dQUIET -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile={{output.pdf}} {{input.pdf}}`
- Merge PDF files:
`gs -dQUIET -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile={{output.pdf}} {{input1.pdf}} {{input2.pdf}}`
- Convert from PostScript file to PDF file:
`gs -dQUIET -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile={{output.pdf}} {{input.ps}}`

View File

@@ -0,0 +1,27 @@
# guix package
> Install, upgrade and remove Guix packages, or rollback to previous configurations.
- Install a new package:
`guix package -i {{package_name}}`
- Remove a package:
`guix package -r {{package_name}}`
- Search the package database for a regular expression:
`guix package -s "{{search_pattern}}"`
- List installed packages:
`guix package -I`
- List generations:
`guix package -l`
- Roll back to the previous generation:
`guix package --roll-back`

View File

@@ -0,0 +1,27 @@
# gunicorn
> Python WSGI HTTP Server.
- Run Python web app:
`gunicorn {{import.path:app_object}}`
- Listen on port 8080 on localhost:
`gunicorn --bind {{localhost}}:{{8080}} {{import.path:app_object}}`
- Turn on live reload:
`gunicorn --reload {{import.path:app_object}}`
- Use 4 worker processes for handling requests:
`gunicorn --workers {{4}} {{import.path:app_object}}`
- Use 4 worker threads for handling requests:
`gunicorn --threads {{4}} {{import.path:app_object}}`
- Run app over HTTPS:
`gunicorn --certfile {{cert.pem}} --keyfile {{key.pem}} {{import.path:app_object}}`

11
pages.cn/linux/halt.md Normal file
View File

@@ -0,0 +1,11 @@
# halt
> Power off or reboot the machine.
- Power the machine off:
`halt`
- Reboot the machine:
`halt --reboot`

View File

@@ -0,0 +1,15 @@
# hardinfo
> Show hardware information in GUI window.
- Start hardinfo:
`hardinfo`
- Print report to standard output:
`hardinfo -r`
- Save report to HTML file:
`hardinfo -r -f html > hardinfo.html`

15
pages.cn/linux/hexdump.md Normal file
View File

@@ -0,0 +1,15 @@
# hexdump
> An ASCII, decimal, hexadecimal, octal dump.
- Print the hexadecimal representation of a file:
`hexdump {{file}}`
- Display the input offset in hexadecimal and its ASCII representation in two columns:
`hexdump -C {{file}}`
- Display the hexadecimal representation of a file, but interpret only n bytes of the input:
`hexdump -C -n{{number_of_bytes}} {{file}}`

View File

@@ -0,0 +1,23 @@
# hostname
> Show or set the system's host name.
- Show current host name:
`hostname`
- Show the network address of the host name:
`hostname -i`
- Show all network addresses of the host:
`hostname -I`
- Show the FQDN (Fully Qualified Domain Name):
`hostname --fqdn`
- Set current host name:
`hostname {{new_hostname}}`

View File

@@ -0,0 +1,11 @@
# hostnamectl
> Get or set the hostname of the computer.
- Get the hostname of the computer:
`hostnamectl`
- Set the hostname of the computer:
`sudo hostnamectl set-hostname "{{some_hostname}}"`

15
pages.cn/linux/htop.md Normal file
View File

@@ -0,0 +1,15 @@
# htop
> Display dynamic real-time information about running processes. An enhanced version of `top`.
- Start htop:
`htop`
- Start htop displaying only processes owned by given user:
`htop -u {{user_name}}`
- Get help about interactive commands:
`?`

View File

@@ -0,0 +1,15 @@
# http-prompt
> An interactive command-line HTTP client featuring autocomplete and syntax highlighting.
- Launch a session targeting the default url of http://localhost:8000 or the previous session:
`http-prompt`
- Launch a session with a given url:
`http-prompt {{http://example.com}}`
- Launch a session with some initial options:
`http-prompt {{localhost:8000/api}} --auth {{username:password}}`

31
pages.cn/linux/httpie.md Normal file
View File

@@ -0,0 +1,31 @@
# httpie
> A user friendly command line HTTP tool.
- Send a GET request (default method with no request data):
`http {{https://example.com}}`
- Send a POST request (default method with request data):
`http {{https://example.com}} {{hello=World}}`
- Send a POST request with redirected input:
`http {{https://example.com}} < {{file.json}}`
- Send a PUT request with a given json body:
`http PUT {{https://example.com/todos/7}} {{hello=world}}`
- Send a DELETE request with a given request header:
`http DELETE {{https://example.com/todos/7}} {{API-Key:foo}}`
- Show the whole HTTP exchange (both request and response):
`http -v {{https://example.com}}`
- Download a file:
`http --download {{https://example.com}}`

Some files were not shown because too many files have changed in this diff Show More