Linux command help


adduser - create a new user or update default new user information
[SYNOPSIS] adduser OPTION USER
option
--home home directory for the new user account
--shell the login shell for the new user account
--no-create-home with no home directory
--uid force use the UID for the new user account
--gid force use GROUP for the new user account



alias - aliases file for sendmail
[SYNOPSIS] alias (alias name)
 
# alias
⇒ show all alias
 
# alias la='ls -a'
⇒ show all alias for ls command



apt-get - install or upgrade packages
[SYNOPSIS] apt-get OPTION COMMAND PACKAGE
command
install Install packages

# apt-get install package
update Download lists of new/upgradable packages.
upgrade Perform an upgrade.
remove Remove packages.

# apt-get remove package
purge Remove packages includes configuration files.

# apt-get purge package
autoremove Remove automatically all unused packages.

# apt-get autoremove package
dist-upgrade Distribution upgrade.
clean Erase downloaded archive files.
autoclean Erase old downloaded archive files.
download Download the binary package into the current directory.
changelog Download and display the changelog for the given package.

option
-y Assume "yes" as answer to all prompts.

# apt-get -y install package
-s Perform a simulation of events that would occur based on the current system state but do not actually change the system.
-d Package files are only retrieved, not unpacked or installed.
-q Produces output suitable for logging, omitting progress indicators.
-h Show help.
-V Show full versions for upgraded and installed packages.
-f Attempt to correct a system with broken dependencies in place.
-u Print out a list of all packages that are to be upgraded.



apt - install or upgrade packages
[SYNOPSIS] apt OPTION COMMAND PACKAGE
command
install Install packages

# apt install package
remove Remove packages

# apt remove package
purge Remove packages includes configuration files

# apt purge package
search Search for a package by name and/or expression
show Display detailed information about a package
update Download lists of new/upgradable packages
full-upgrade Perform an upgrade, possibly installing and removing packages

option
-y Assume that the answer to simple yes/no questions is 'yes'

# apt -y install package
-v Display extra information. (may be supplied multiple times)
-h Help text



aptitude - high-level interface to the package manager
[SYNOPSIS] aptitude OPTION COMMAND PACKAGE
command
install Install/upgrade packages

# aptitude install package
remove Remove packages

# aptitude remove package
purge Remove packages and their configuration files

# aptitude purge package
search Search for a package by name and/or expression
show Display detailed information about a package
changelog View a package's changelog
update Download lists of new/upgradable packages
safe-upgrade Perform a safe upgrade
full-upgrade Perform an upgrade, possibly installing and removing packages
download Download the .deb file for a package
reinstall Download and (possibly) reinstall a currently installed package
clean Erase downloaded package files
forget-new Forget what packages are "new"
hold Place packages on hold
unhold Cancel a hold command for a package
markauto Mark packages as having been automatically installed
unmarkauto Mark packages as having been manually installed
forbid-version Forbid aptitude from upgrading to a specific package version.
why Show the manually installed packages that require a package, or why one or more packages would require the given package
why-not Show the manually installed packages that lead to a conflict with the given package, or why one or more packages would
lead to a conflict with the given package if installed

option
-y Assume that the answer to simple yes/no questions is 'yes'

# aptitude -y install package
-s Simulate actions, but do not actually perform them.
-d Only download packages, do not install or remove anything.
-v Display extra information. (may be supplied multiple times)
-q In command-line mode, suppress the incremental progress indicators.
-h Help text
-V Show which versions of packages are to be installed.
-P Always prompt for confirmation or actions
-f Aggressively try to fix broken packages.
-D Show the dependencies of automatically changed packages.
-Z Show the change in installed size of each package.
-u Download new package lists on startup.
-i Perform an install run on startup.



autoconf - generate configure script
[SYNOPSIS] autoconf OPTION
option
-h Help text



awk - awk is a pattern scanning and processing language
[SYNOPSIS] awk OPTION (file and so on)
option
-F specify field-separator



cat - Concatenate FILE(s), or standard input, to standard output.
[SYNOPSIS] cat OPTION FILE
option
-n number all output lines
-b number nonblank output lines
-s never more than one single blank line



cd - change directory
[SYNOPSIS] cd DIRECTORY



chage - change user password expiry information
[SYNOPSIS] chage OPTION USER
option
-l show account aging information
-M days set maximim number of days before password change to MAX_DAYS
-m days set minimum number of days before password change to MIN_DAYS
-W days set expiration warning days to WARN_DAYS
-I days set password inactive after expiration to INACTIVE



chgrp - change group ownership
[SYNOPSIS] chgrp OPTION GROUP FILE/DIRECTORY
option
-R operate on files and directories recursively

# chgrp -R user dir



chkconfig - updates and queries runlevel information for system services
[SYNOPSIS] chkconfig OPTION SERVICE
option
--list This option lists all of the services which chkconfig knows about, and whether they are
stopped or started in each runlevel. If name is specified, information in only display about
service name.
--level Specifies the run levels an operation should pertain to. It is given as a string of numbers
from 0 to 6. For example, --level 35 specifies runlevels 3 and 5.



chmod - change file access permissions
[SYNOPSIS] chmod OPTION PERMISSIONS FILE/DIRECTORY
option
-R change files and directories recursively

# chmod -R 700 /home



chown - change file owner and group
[SYNOPSIS] chown OPTION USER FILE/DIRECTORY
option
-R operate on files and directories recursively

# chown -R user dir



clear
clear the terminal screen



cp - copy files and directories
[SYNOPSIS] cp OPTION (SOURCE FILE/DIRECTORY] [DEST FILE/DIRECTORY]
option
-i prompt before overwrite

# cp -i file /etc
-f if an existing destination file cannot be opened, remove it and try again

# cp -f file /etc
-b like --backup but does not accept an argument

# cp -b file /etc
-p preserve the specified attributes (default: mode,ownership,timestamps)

# cp -p file /etc
-r(R) copy directories recursively

# cp -R dir /etc



crontab - maintain crontab files for individual users
option
-e edit user's crontab
-l list user's crontab
-r delete user's crontab



cut - remove sections from each line of files
[SYNOPSIS] cut OPTION FILE
option
-c select only these characters
-d use DELIM instead of TAB for field delimiter
-f select only these fields; also print any line that contains no delimiter character, unless the -s option is specified



date - print or set the system date and time
[SYNOPSIS] date OPTION
option
-R output date and time in RFC 2822 format



dd - convert and copy a file
[SYNOPSIS] dd OPTION
option
if=FILE read from FILE instead of stdin
of=FILE write to FILE instead of stdout
bs=BYTES force ibs=BYTES and obs=BYTES
count=BLOCKS copy only BLOCKS input blocks
seek=BLOCKS skip BLOCKS obs-sized blocks at start of output



depmod - program to generate modules.dep and map files
[SYNOPSIS] depmod OPTION (MODULE)
option
-a Probe all modules. This option is enabled by default if no file names are given in the command-line.



df - report file system disk space usage
[SYNOPSIS] df OPTION DIRECTORY
option
-h print sizes in human readable format (e.g., 1K 234M 2G)
-m print sizes in M-bytes
-k print sizes in K-bytes
-i list inode information instead of block usage



dig - DNS lookup utility
[SYNOPSIS] dig OPTION (HOST NAME/IP ADDR)
option
  typical invocation

# dig yahoo.com
-x reverse invocation

# dig -x 111.222.333.444



dmesg
print or control the kernel ring buffer



dnf - Package manager for RPM
[SYNOPSIS] dnf OPTION COMMAND PACKAGE
command
install Install a package or packages on your system

# dnf install package
reinstall reinstall a package
upgrade Upgrade a package or packages on your system

# dnf upgrade package
upgrade-to Upgrade a package on your system to the specified version
remove Remove a package or packages from your system

# dnf remove package
group Display, or use, the groups information
list List a package or groups of packages
check-update Check for available package upgrades
info Display details about a package or group of packages
provides Find what package provides the given value
search Search package details for the given string

# dnf search keyword
history Display, or use, the transaction history
updateinfo Display advisories about packages

option
-y answer yes for all questions

# dnf -y install package
--enablerepo=repo enable one or more repositories (wildcards allowed)

# dnf --enablerepo=repo install package
--disablerepo=repo disable one or more repositories (wildcards allowed)

# dnf --disablerepo=repo install package
--installroot [path] set install root
--exclude=package exclude packages by name or glob

# dnf --exclude=package update
--releasever RELEASEVER override the value of $releasever in config and repo files
--noplugins disable all plugins

# dnf --noplugins update



du - estimate file space usage
[SYNOPSIS] du OPTION DIRECTORY
option
-a write counts for all files, not just directories
-h print sizes in human readable format (e.g., 1K 234M 2G)
-s display only a total for each argument



e2fsck - check a Linux ext2/ext3 file system
[SYNOPSIS] e2fsck OPTION DEVICE
option
-c Check for bad blocks and add them to the badblock list
-p Automatic repair (no questions)
-v Be verbose
-y Assume "yes" to all questions



echo - display a line of text
[SYNOPSIS] echo OPTION STRING
option
-n do not output the trailing newline
-e enable interpretation of backslash escapes



edquota - edit user quotas
[SYNOPSIS] edquota OPTION USER/GROUP
option
-u Edit the user quota. This is the default.
-g Edit the group quota.
-t Edit the soft time limits for each filesystem.
-f filesystems Perform specified operations only for given filesystem (default is to perform operations for all filesystems with quota).



ethtool - Display or change ethernet card settings
[SYNOPSIS] ethtool INTERFACE



exit - exit shell



expand - convert tabs to spaces
[SYNOPSIS] expand OPTION FILE
option
-i do not convert tabs after non blanks
-t [tabs NUMBER] have tabs NUMBER characters apart, not 8



export - define $ENV
[SYNOPSIS] export $ENV



expr - evaluate expressions
[SYNOPSIS] expr ARG1 EXPRESSION ARG2



fdisk - Partition table manipulator for Linux
[SYNOPSIS] fdisk DEVICE
operation
m show help
p show partition table
n create a new partition
d remove a partition
t change file-type
q quit without saving
w quit with saving



file - determine file type
[SYNOPSIS] file FILE



find - search for files in a directory hierarchy
[SYNOPSIS] find PATH OPTION
option
-name PATTERN Search from file name with the PATTERN

# find ./ -name file.txt
-perm PATTERN Search from permissions with the PATTERN

# find ./ -perm -o+x
-size SIZE Search from file-size with the SIZE

# find ./ -size 1140c
-type TYPE Search from file-type with the TYPE

# find ./ -type d
-user USER Search from owner with the USER

# find ./ -user root
-group GROUP Search from group with the GROUP

# find ./ -group root
-exec COMMAND {} \; Execute command when matching

# find ./ -size 1140c -exec cat {} \;
-print list search-result
-fprint FILE print the full file name into file file
-ls list current file in ‘ls -dils’ format on standard output
-nouser No user corresponds to file’s numeric user ID
-nogroup No group corresponds to file’s numeric group ID
-and Search with "AND"
-or Search with "OR"
-atime N File was last accessed N*24 hours ago
-mtime N File’s data was last modified N*24 hours ago
-ctime N File’s status was last changed N*24 hours ago
-newer FILE File was modified more recently than file
-links N File has N links



fmt - simple optimal text formatter
[SYNOPSIS] fmt OPTION FILE
option
-w WIDTH maximum line width (default of 75 columns)



free - Display amount of free and used memory in the system
[SYNOPSIS] free OPTION
option
-m switch displays it in megabytes
-k switch displays it in kilobytes
-b switch displays it in bytes
-s second switch activates continuous polling delay seconds apart

# free -s 3



fsck - check and repair a Linux file system
[SYNOPSIS] fsck OPTION DEVICE
option
-n Make no changes to the filesystem
-t fslist Specifies the type(s) of file system to be checked

# fsck -t vfat /dev/sda2



ftp - connect to a FTP server
[SYNOPSIS] ftp HOST



getfacl - get file access control lists
Usage : getfacl option file
Option
-a display the file access control list only
-d display the default access control list only
-c do not display the comment header
-R recurse into subdirectories



gpasswd - administer /etc/group and /etc/gshadow
[SYNOPSIS] gpasswd OPTION GROUP
option
-A Set the list of administrative users

# gpasswd -A user group
-a Add the user to the named group

# gpasswd -a user group
-d Remove the user from the named group

# gpasswd -d user group
-r Remove the password from the named group

# gpasswd -r group



grep - print lines matching a pattern
[SYNOPSIS] grep OPTION PATTERN FILE
option
-i Ignore case distinctions in both the PATTERN and the input files
-n Prefix each line of output with the 1-based line number within its input file
-v Invert the sense of matching, to select non-matching lines
-w Select only those lines containing matches that form whole words
-r(R) dir Read all files under each directory, recursively; this is equivalent to the -d recurse option

# grep -r 'word' dir



groupadd - create a new group
[SYNOPSIS] groupadd OPTION GROUP
option
-g use GID for the new group

# groupadd -g 510 group



groupdel - remove a group
[SYNOPSIS] groupdel GROUP



groupmod - modify a group definition on the system
[SYNOPSIS] groupmod OPTION GROUP
option
-n change the name to NEW_GROUP

# groupmod -n new_name group
-g change the group ID to GID

# groupmod -g 600 group



groups
print the groups a user is in



gunzip - compress or expand files
[SYNOPSIS] gunzip OPTION FILE
option
-v Verbose. Display the name and percentage reduction for each file compressed or decompressed



gzip - compress or expand files
[SYNOPSIS] gzip OPTION FILE
option
-d Decompress
-v Verbose
-r Travel the directory structure recursively



halt - stop the system
[SYNOPSIS] halt (-p)



head - output the first part of files
[SYNOPSIS] head OPTION FILE
option
no option (default) Print the first 10 lines
-N Print the N lines

# head -20 file



history - list histories of commands



hostname - display or set its hostname or NIS domain name
[SYNOPSIS] hostname OPTION
option
-d Display the name of the DNS domain



hostnamectl - Query or change system hostname.
[SYNOPSIS] hostnamectl {OPTIONS} {COMMAND}
OPTIONS
--transient Only set transient hostname
--privileged Acquire privileges before execution
--host=[USER@]HOST Operate on remote host

COMMAND
status Show current hostname settings
set-hostname HOSTNAME Set system hostname



htpasswd - Manage user files for basic authentication
[SYNOPSIS] htpasswd OPTION PASSWORDFILE USER PASSWORD
option
-c Create the passwdfile. If passwdfile already exists, it is rewritten and truncated
-b Use batch mode; i.e., get the password from the command line rather than prompting for it
-n Display the results on standard output rather than updating a file
-m Use MD5 encryption for passwords
-d Use crypt() encryption for passwords (default)
-s Use SHA encryption for passwords
-p Use plaintext passwords
-D Delete user



hwclock - query and set the hardware clock (RTC)
[SYNOPSIS] hwclock OPTION
option
--systohc Set the Hardware Clock to the current System Time



id - Print information for USERNAME, or the current user.
[SYNOPSIS] id USER



ifconfig - configure a network interface
[SYNOPSIS] ifconfig INTERFACE ADDRESS
  show status of active interfaces

# ifconfig
  enable an interfce

# ifconfig eth0 up
  disable an interface

# ifconfig eth0 down
  change IP address of an interface

# ifconfig eth0 192.168.0.10
  change subnet-mask of an interface

# ifconfig eth0 netmask 255.255.255.248



insmod - simple program to insert a module into the Linux Kernel
[SYNOPSIS] insmod OPTION MODULE
option
-s output rusults to syslog
-v show verbose



join - join lines of two files on a common field
[SYNOPSIS] join OPTION FILE1 FILE2
option
-j equivalent to ‘-1 FIELD -2 FIELD’
-j 1 join on this FIELD of file 1
-j 2 join on this FIELD of file 2



ldconfig
configure dynamic linker run time bindings



ldd - print shared library dependencies
[SYNOPSIS] ldd PROGRAM



less - opposite of more
[SYNOPSIS] less OPTION FILE
option
- N Causes a line number to be displayed at the beginning of each line in the display

cpmmands
key description
[↓] Forward one line
[↑] Backward one line
[Space] Forward one window
b Backward one window
q quit



ln - make links between files
[SYNOPSIS] ln OPTION TARGET LINK_NAME
option
-s make symbolic links instead of hard links



localectl - Query or change system locale and keyboard settings.
[SYNOPSIS] localectl {OPTIONS} {COMMAND}
OPTIONS
--privileged Acquire privileges before execution
--no-pager Do not pipe output into a pager
--host=[USER@]HOST Operate on remote host

COMMAND
status Show current locale settings
set-locale LOCALE Set system locale
list-locales Show known locales
set-keymap MAP Set virtual console keyboard mapping
list-keymaps Show known virtual console keyboard mappings
set-x11-keymap LAYOUT Set X11 keyboard mapping
list-x11-keymap-layouts Show known X11 keyboard mapping layouts
list-x11-keymap-models Show known X11 keyboard mapping models



locate - find files by name
[SYNOPSIS] locate FILE
Use updatedb if update locate database



ls - list directory contents
[SYNOPSIS] ls OPTION FILE/DIRECTORY
option
-l use a long listing format
-a do not ignore entries starting with
-d list directory entries instead of contents, and do not dereference symbolic links
-r reverse order while sorting
-t sort by modification time
-S sort by file size
-X sort alphabetically by entry extension
-i with -l, print the index number of each file
-R list subdirectories recursively
-F append indicator (one of */=>@|) to entries



lsmod - program to show the status of modules in the Linux Kernel
[SYNOPSIS] lsmod



lspci - list all PCI devices



lvcreate - create a logical volume in an existing volume group

option
-n Gives the name for the new logical volume
-L Gives the size to allocate for the new logical volume

# lvcreate -L 5G -n NAME VG
-h Show helps



make - GNU make utility to maintain groups of programs

-f Use file as a makefile

# make -f makefile
-n Don't actually run any commands; just print them



man - format and display the on-line manual pages
[SYNOPSIS] man COMMAND



mkdir - make directories
[SYNOPSIS] mkdir OPTION DIRECTORY
option
-p no error if existing, make parent directories as needed

# mkdir /home/dir1/dir2
-m set permission mode (as in chmod), not rwxrwxrwx - umask

# mkdir -m 700 dir



mkfs - build a Linux file system
[SYNOPSIS] mkfs OPTION DEVICE
option
-c Check the device for bad blocks before building the file system
-t Specifies the type of file system to be built

# mkfs -t ext3 partition



mkswap - set up a Linux swap area
[SYNOPSIS] mkswap DEVICE



modinfo - program to show information about a Linux Kernel module
[SYNOPSIS] modinfo OPTION MODULE
option
-a show only author
-d ahow only description
-n show only file name



modprobe - program to add and remove modules from the Linux Kernel
[SYNOPSIS] modprobe OPTION MODULE
option
-a Insert all module names on the command line
-l List all modules matching the given wildcard
-r This option causes modprobe to remove, rather than insert a module



mount - mount a file system
[SYNOPSIS] mount OPTION DEVICE MOUNT-POINT
option
-a Mount all filesystems (of the given types) mentioned in fstab
-t The argument following the -t is used to indicate the file system type

# mount -t nfs example.com:/home /mnt



mv - move (rename) files
[SYNOPSIS] mv OPTION SOURCE DEST
option
-i prompt before overwrite

# mv -i file /etc
-f do not prompt before overwriting

# mv -f file /etc
-b like --backup but does not accept an argument

# mv -b file /etc
-u move only when the SOURCE file is newer than the destination file or when the destination file is missing

# mv -u file /etc



netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multi-cast memberships
[SYNOPSIS] netstat OPTION
option
-a Show both listening and non-listening sockets
-r show routing table
-i show interface's tables
-l Show only listening sockets
-n don't resolve names
-p Show the PID and name of the program to which each socket belongs
-v show verbose
-e Display additional information
-g display multicast group memberships
-s display networking statistics (like SNMP)
-o display timers
-c continuous listing
-M display masqueraded connections
-F display Forwarding Information Base (default)
-C display routing cache instead of FIB



newaliases
When changing /etc/aliases , enable the change with the command



newgrp - log in to a new group
[SYNOPSIS] newgrp GROUP



nl - number lines of files
[SYNOPSIS] nl OPTION FILE
option
-h use STYLE for numbering header lines
-f use STYLE for numbering footer lines



ntpq - standard NTP query program
[SYNOPSIS] ntpq OPTION
option
-p Print a list of the peers known to the server as well as a summary of their state
-? show helps
-! show helps with more details
-v show version info
-i Force ntpq to operate in interactive mode



passwd - update a user’s authentication tokens(s)
[SYNOPSIS] passwd OPTION USER
option
-d This is a quick way to disable a password for an account

# passwd -d user
-l This option is used to lock the specified account and it is available to root only

# passwd -l user
-u This is the reverse of the -l option - it will unlock the account password by removing the ! prefix

# passwd -u user
-x This will set the maximum password lifetime, in days, if the user’s account supports password life-times

# passwd -x 10 user
-n This will set the minimum password lifetime, in days, if the user’s account supports password life-times. Available to root only

# passwd -n 10 user
-i This will set the number of days which will pass before an expired password for this account will be
taken to mean that the account is inactive and should be disabled, if the user’s account supports pass-word lifetimes

# passwd -i 10 user
-w This will set the number of days in advance the user will begin receiving warnings that her password will expire, if the user’s account supports password lifetimes

# passwd -w 10 user
-S This will output a short information about the status of the password for a given account

# passwd -S user
   user PS 2009-09-12 0 99999 7 -1 (Password set, MD5 crypt.)



paste - merge lines of files
[SYNOPSIS] paste OPTION FILE1 FILE2
option
-d reuse characters from LIST instead of TABs



ping - send ICMP ECHO_REQUEST to network hosts
[構SYNOPSIS文] ping OPTION HOST
option
-c count Stop after sending count ECHO_REQUEST packets



pr - convert text files for printing
[SYNOPSIS] pr OPTION FILE
option
+ FIRST_PAGE printing with page FIRST_PAGE
- COLUMN output COLUMN columns and print columns down, unless -a is used
-w PAGE_WIDTH set page width to PAGE_WIDTH characters for multiple text-column output only, -s[char] turns off



quota - display disk usage and limits
[SYNOPSIS] quota OPTION
option
  By default only the user quotas are printed
-q Print a more terse message, containing only information on filesystems where usage is over quota



quotacheck - scan a filesystem for disk usage, create, check and repair quota files
[SYNOPSIS] quotacheck OPTION FILE-SYSTEM
option
-b Forces quotacheck to make backups of the quota file before writing the new data
-v quotacheck reports its operation as it progresses
-d Enable debugging mode
-u Only user quotas listed in /etc/mtab or on the filesystems specified are to be checked
-g Only group quotas listed in /etc/mtab or on the filesystems specified are to be checked
-c Don’t read existing quota files. Just perform a new scan and save it to disk
-f Forces checking and writing of new quota files on filesystems with quotas enabled
-a Check all mounted non-NFS filesystems in /etc/mtab
-m Don’t try to remount filesystem read-only. See comment with option -M
-M This flag forces checking of filesystem in read-write mode if a remount fails
-R When used together with the -a option, all filesystems except for the root filesystem are checked for quotas



quotaoff - turn filesystem quotas on and off
[SYNOPSIS] quotaoff OPTION FILE-SYSTEM
option
-a All automatically mounted (no noauto option) non-NFS filesystems in /etc/fstab with quotas will have their quotas turned on. This is normally used at boot time to enable quotas
-v Display a message for each filesystem where quotas are turned on
-u Manipulate user quotas. This is the default
-g Manipulate group quotas
-p Instead of turning quotas on just print state of quotas (ie. whether. quota is on or off)



quotaon - turn filesystem quotas on and off
[SYNOPSIS] quotaon OPTION FILE-SYSTEM
option
-a All automatically mounted (no noauto option) non-NFS filesystems in /etc/fstab with quotas will have their quotas turned on
-v Display a message for each filesystem where quotas are turned on
-u Manipulate user quotas. This is the default
-g Manipulate group quotas
-p Instead of turning quotas on just print state of quotas (ie. whether. quota is on or off)
-f Make quotaon behave like being called as quotaoff



reboot - reboot the system



repquota - summarize quotas for a filesystem
[SYNOPSIS] repquota OPTION FILE-SYSTEM
option
-a Report on all filesystems indicated in /etc/mtab to be read-write with quotas
-v Report all quotas, even if there is no usage. Be also more verbose about quotafile information
-u Report quotas for users. This is the default
-g Report quotas for groups
-s Try to report used space, number of used inodes and limits in more appropriate units than the default ones



rm - remove files or directories
[SYNOPSIS] rm OPTION FILE
option
-i prompt before any removal

# rm -i file
-f ignore nonexistent files, never prompt

# rm -f file
-r(-R) remove directories and their contents recursively

# rm -rf dir



rmdir - remove empty directories
[SYNOPSIS] rmdir DIRECTORY

note: Use "rm -rf" if directories are not empty



rmmod - simple program to remove a module from the Linux Kernel
[SYNOPSIS] rmmod OPTION MODULE
option
-a remove all unused modules
-s says use syslog, not stderr



rndc - name server control utility
[SYNOPSIS] rndc COMMAND
command
reload reload config and zones

# rndc reload
status show status of a name server

# rndc status
retransfer zone transfer zones

# rndc retransfer zone



rpm - RPM Package Manager
[SYNOPSIS] rpm OPTION PACKAGE
option
-i This installs a new package

# rpm -i package
-F This will upgrade packages, but only if an earlier version currently exists

# rpm -F package
-U This upgrades or installs the package currently installed to a newer version

# rpm -U package
-e erase (uninstall) package

# rpm -e package
-q query packages

# rpm -q package
-V verify installed packages

# rpm -V package
-K verify package signature

# rpm -K package
--rebuilddb rebuild the database indices from the installed package headers

# rpm --rebuilddb
--initdb create a new database if one doesn’t already exist

# rpm --initdb
--import import PUBKEY

# rpm --import /usr/share/rhn/RPM-GPG-KEY
options with i, U
-v show package name

# rpm -iv package
-h display progress

# rpm -ivh package
-vv Print lots of ugly debugging information

# rpm -ivv package
--nodeps Don’t do a dependency check before installing or upgrading a package

# rpm -ivh --nodeps package
--test Don’t really uninstall anything, just go through the motions

# rpm -ivh --test package
options with q
-a Query all installed packages

# rpm -qa
-i Display package information, including name, version, and description. This uses the --queryformat if one was specified

# rpm -qi package
-l List files in package

# rpm -ql package
-c List only configuration files (implies -l)

# rpm -qc package
-d List only documentation files (implies -l)

# rpm -qd package
-f Query package owning FILE

# rpm -qf /bin/bash
-R List packages on which this package depends

# rpm -qR package
-s Display the states of files in the package (implies -l)

# rpm -qs package
--last Orders the package listing by install time such that the latest packages are at the top

# rpm -q --last package
--changelog Display change information for the package

# rpm -q --changelog package



rpmbuild - Build RPM Package
[SYNOPSIS] rpmbuild OPTION SPEC-FILE/SRPM-FILE
option
-ba Build binary and source packages (after doing the %prep, %build, and %install stages)
-bb Build a binary package (after doing the %prep, %build, and %install stages)
-bs Build just the source package
-bp Executes the "%prep" stage from the spec file. Normally this involves unpacking the sources and applying any patches
-bc Do the "%build" stage from the spec file (after doing the %prep stage). This generally involves the equivalent of a "make"
-bi Do the "%install" stage from the spec file (after doing the %prep and %build stages)



rsync - faster, flexible replacement for rcp
[SYNOPSIS] rsync OPTION SRC DEST
option
-v increase verbosity
-a archive mode; same as -rlptgoD (no -H)
-u skip files that are newer on the receiver
-z compress file data during the transfer
--exclude=PATTERN exclude files matching PATTERN
--delete delete files that don’t exist on sender
# rsync -av --exclude="tmp" /home/ /backup



setfacl - set file access control lists
Usage : setfacl option file
Option
-m modify the current ACL(s) of file(s)
-x remove entries from the ACL(s) of file(s)
-b remove all extended ACL entries
-R recurse into subdirectories
-d operations apply to the default ACL
-k remove the default ACL
--restore=file restore ACLs (inverse of `getfacl -R')



setup
setup devices and file systems, mount root file system



sfdisk - Partition table manipulator for Linux
[SYNOPSIS] sfdisk OPTION DEVICE
option
-l List the partitions of a device



shutdown - bring the system down
[SYNOPSIS] shutdown OPTION TIME MESSAGE
-h Halt or poweroff after shutdown

# shutdown -h now
-r Reboot after shutdown

# shutdown -r +10
-f Skip fsck on reboot

# shutdown -rf +20 "This System will shutdown soon"
-k Don’t really shutdown; only send the warning messages to everybody

# shutdown -k now
-c Cancel an already running shutdown

# shutdown -c



smbpasswd - change a user SMB password
[SYNOPSIS] smbpasswd OPTION USER
option
-a add user
-e enable user
-d disable user
-n set no password
-x delete user
-h show helps
-c smb.conf file Use the given path to the smb.conf file
-r MACHINE specify remote MACHINE
-U USER specify remote USER



sort - sort lines of text files
[SYNOPSIS] sort OPTION FILE
option
-o FILE write result to FILE instead of standard output
-f fold lower case to upper case characters
-r reverse the result of comparisons
-n compare according to string numerical value
-k --key=POS1[,POS2] start a key at POS1, end it at POS2 (origin 1)
-t --field-separator=SEP use SEP instead of non-blank to blank transition



source
Read and execute commands from filename in the current shell environment and return the exit status of the last command executed from filename



split - split a file into pieces
[SYNOPSIS] paste OPTION INPUT PREFIX
option
-l --lines=NUMBER put NUMBER lines per output file



ss : display more TCP and state informations
[SYNOPSIS] ss [options] [ FILTER ]
Options
-h, --help show help
-V, --version output version information
-n, --numeric don't resolve service names
-r, --resolve resolve host names
-a, --all display all sockets
-l, --listening display listening sockets
-o, --options show timer information
-e, --extended show detailed socket information
-m, --memory show socket memory usage
-p, --processes show process using socket
-i, --info show internal TCP information
-s, --summary show socket usage summary
-b, --bpf bpf フィルター��ソケット情報を表示
-Z, --context display process SELinux security contexts
-z, --contexts display process and socket SELinux security contexts
-4, --ipv4 display only IP version 4 sockets
-6, --ipv6 display only IP version 6 sockets
-t, --tcp display only TCP sockets
-u, --udp display only UDP sockets
-d, --dccp display only DCCP sockets
-w, --raw display only RAW sockets
-x, --unix display only Unix domain sockets
-f, --family=FAMILY display sockets of type FAMILY
-D, --diag=FILE Dump raw information about TCP sockets to FILE
-F, --filter=FILE read filter information from FILE
FILTER := [ state TCP-STATE ] [ EXPRESSION ]



startx
initialize an X session



su - run a shell with substitute user and group IDs
[SYNOPSIS] su [-] USER
  make the shell a login shell

# su - user



sudo - sudoedit - execute a command as another user
[SYNOPSIS] sudo OPTION COMMAND
option
-u USER causes sudo to run the specified command as a user other than root
-s runs the shell specified by the SHELL environment variable if it is set or the shell as specified in passwd(5)
-H sets the HOME environment variable to the homedir of the target user (root by default) as specified in passwd(5)
-l The -l (list) option will list out the allowed (and forbidden) commands for the invoking user on the current host
-h show help
-v sudo will update the user’s timestamp, prompting for the user’s password if necessary
-k The option to sudo invalidates the user’s timestamp by setting the time on it to the Epoch
-K The option is like -k except that it removes the user’s timestamp entirely
-b The option tells sudo to run the given command in the background



sysctl - configure kernel parameters at runtime
[SYNOPSIS] sysctl OPTION
option
-a Display all values currently available. Please see the NOTES
-p Load in sysctl settings from the file specified or /etc/sysctl.conf if none given



systemctl - Query or send control commands to the systemd manager.
[SYNOPSIS] systemctl OPTIONS COMMAND
OPTIONS
--all Show all units/properties, including dead/empty ones

# systemctl --all
--t List only units of a particular type

# systemctl -t service

COMMAND
start Start (activate) one or more units

# systemctl start sendmail.service
stop Stop (deactivate) one or more units

# systemctl stop sendmail.service
reload Reload one or more units

# systemctl reload sendmail.service
restart Start or restart one or more units

# systemctl restart sendmail.service
status Show runtime status of one or more units

# systemctl status sendmail.service
enable Enable one or more unit files

# systemctl enable sendmail.service
disable Disable one or more unit files

# systemctl disable sendmail.service



sysv-rc-conf - Run-level configuration for SysV like init script links
[SYNOPSIS] sysv-rc-conf OPTION SERVICE
option
--list This option will list all of the services and if they are stopped or started when entering each runlevel

# sysv-rc-conf --list rsync
--level The runlevels this operation will affect. levels can be any number from 0-9 or S

# sysv-rc-conf --level 3 rsync off



tac - concatenate and print files in reverse
[SYNOPSIS] tac FILE



tail - output the last part of files
[SYNOPSIS] tail OPTION FILE
option
(no option) output the last 10 lines (default)
-n, --lines=N output the last N lines, instead of the last 10

# tail -20 file



tar - The GNU version of the tar archiving utility
[SYNOPSIS] tar OPTION FILE
option
f use archive file or device ARCHIVE
v verbosely list files processed
x extract files from an archive

# tar xvf file.tar
z filter the archive through gzip

# tar zxvf file.tar.gz
j filter the archive through bzip2

# tar jxvf file.tar.bz2
c create a new archive

# tar cvf file.tar file1 file2
t list the contents of an archive

# tar tvf file.tar
u only append files newer than copy in archive

# tar uvf file.tar file1
--delete delete from the archive (not on mag tapes!)

# tar --delete -vf file.tar file1



tasksel
install or remove packages



timedatectl - Query or change system time and date settings.
[SYNOPSIS] timedatectl {OPTIONS} {COMMAND}
OPTIONS
--privileged Acquire privileges before execution
--no-pager Do not pipe output into a pager
--host=[USER@]HOST Operate on remote host

COMMAND
status Show current time settings
set-time TIME Set system time
set-timezone ZONE Set system timezone
list-timezones Show known timezones



touch - change file timestamps
[SYNOPSIS] touch OPTION TIME FILE
option
-t use [[CC]YY]MMDDhhmm[.ss] instead of current time

# touch -t 200712312359.59 file
-a change only the access time
-m change only the modification time



traceroute - print the route packets trace to network host
[SYNOPSIS] traceroute OPTION HOST



tune2fs - adjust tunable filesystem parameters on ext2/ext3 filesystems
[SYNOPSIS] tune2fs OPTION DEVICE
option
-L Set the volume label of the filesystem
-j Add an ext3 journal to the filesystem



umask
show umask



umount - unmount file systems
[SYNOPSIS] umount DEVICE
 
# umount /mnt
⇒ unmount the device mounted on /mnt



unalias - remove alias
[SYNOPSIS] unalias ALIAS NAME



uname - print system information
[SYNOPSIS] uname OPTION
option
-n print the network node hostname
-s print the kernel name
-m print the machine hardware name
-p print the processor type or "unknown"
-r print the kernel release
-v print the kernel version
-a print all information, in the following order, except omit -p and -i if unknown



uniq - report or omit repeated lines
[SYNOPSIS] uniq OPTION INPUT OUTPUT
option
-d only print duplicate lines
-u only print unique lines



unzip - list, test and extract compressed files in a ZIP archive
[SYNOPSIS] unzip OPTION FILE
option
-l list archive files (short format)
-t test archive files
-z display only the archive comment



update-rc.d - install and remove System-V style init script links
[SYNOPSIS] update-rc.d OPTION SERVICE ACTION
action
defaults make links to start the service in runlevels 2345 and to stop the service in runlevels 016

# update-rc.d sshd defaults
remove remove all links to start the service

# update-rc.d sshd remove

option
-n Don't do anything, just show what we would do
-f Force removal of symlinks



updatedb
update a database for mlocate



useradd - create a new user or update default new user information
[SYNOPSIS] useradd OPTION USER
option
-s the login shell for the new user account

# useradd -s /sbin/nologin user
-d home directory for the new user account

# useradd -d /home/user user
-g force use GROUP for the new user account

# useradd -g group user
-e set account expiration date to EXPIRE_DATE

# useradd -e 20081231 user
-u force use the UID for the new user account

# useradd -u 550 user
-m create home directory for the new user account

# useradd -m user
-M do not create user's home directory(overrides /etc/login.defs)

# useradd -M user



userdel - delete a user account and related files
[SYNOPSIS] userdel OPTION USER
option
-r remove home directory and mail spool



usermod - modify a user account
[SYNOPSIS] usermod OPTION USER
option
-d new home directory for the user account
-g force use GROUP as new primary group
-G new list of supplementary GROUPS
-s new login shell for the user account
-u new UID for the user account
-L lock the user account
-U unlock the user account



vi - Use vi editor
[SYNOPSIS] vi FILE
Switch Command mode/Input mode
Key Description
i insert words on the Cursor position
a insert words after the Cursor position
I insert words on the head of the line of Cursor position
A insert words on the last of the line of Cursor position
o insert words on the empty line inserted that is after Cursor position
O insert words on the empty line inserted that is before Cursor position
[Esc] switch to command mode

Save/Quit
Key Description
:w save
:w file save as a file
:q quit without saving(confirmed)
:q! quit without saving(forcely)
:wq save and quit
:e back to the last saved
:n switch to other file if some files are opened
:r file read content of a file on current line
:n,mw file save as a file from n line to m line
:n,mw>>file add to a file from n line to m line

Cursor operation
Key Description
h (or) [�] move to left
l (or) [→] move to right
k (or) [↑] move to above
j (or) [↓] move to below
w move to the head of next word
b move to the head of previous word
0 move to the head of line
$ move to the last of line
G move to the last line
nG move to n line
H move to the head of current screen
nH move to n line on current screen
L move to the last line on current screen
nL move to the line of "n"
M move to the head line on current screen

Scrolling operation
Key Description
[Ctrl] + f scroll down for a screen
[Ctrl] + b scroll up for a screen
[Ctrl] + d scroll down for half of a screen
[Ctrl] + u scroll up for half of a screen

Edit operation
Key Description
x delete a word on cursor
X delete a word before cursor
yy copy the current line into the buffer
y$ copy from the cursor position to the end of the line into the buffer
y0 copy from the head of line to the cursor position into the buffer
yw copy a word on cursor into the buffer
p paste the contents of the buffer after the cursor position
P paste the contents of the buffer before the cursor position
dd delete the current line
d$ delete from the cursor position to the end of the line
d0 delete from the head of the line to the cursor position
dw delete from the head of the line to the next word
u cancel the last operation
U cancel the last operation for a line

Search operation
Key Description
/ word [Enter] search a word from the head of a file to the end
? word [Enter] search a word from the end of a file to the head
n search next after a result of searching



visudo - edit the sudoers file
[SYNOPSIS] visudo OPTION
option
-c Enable check-only mode
-f FILE Specify and alternate sudoers file location
-q Enable quiet mode
-s Enable strict checking of the sudoers file



vncpasswd
set VNC password



wc - print the number of newlines, words, and bytes in files
[SYNOPSIS] wc OPTION FILE
option
-c print the byte counts
-l print the newline counts
-w print the word counts



wget - The non-interactive network downloader
[SYNOPSIS] wget URL
option
-c resume getting a partially-downloaded file



which - shows the full path of (shell) commands
[SYNOPSIS] which COMMAND



xargs - build and execute command lines from standard input
[SYNOPSIS] xargs OPTION COMMAND



yast2
run YaST Control Center



ypcat - print values of all keys in a NIS database
[SYNOPSIS] ypcat OPTION MAP
option
 
# ypcat passwd
⇒ show passwd map on NIS database
 
# ypcat hosts
⇒ show hosts map on NIS database



yppasswd - change your password in the NIS database



ypwhich - return name of NIS server or map master



yum - Yellowdog Updater Modified
[SYNOPSIS] yum OPTION COMMAND PACKAGE
command
install Install a package or packages on your system

# yum install package
update Update a package or packages on your system

# yum update package
remove Remove the packages

# yum remove package
groupinstall Install the packages in a group on your system

# yum groupinstall "X Window System"
groupupdate Update the packages in a group on your system

# yum groupupdate "X Window System"
groupremove Remove the packages in a group from your system

# yum groupremove "X Window System"
list List a package or groups of packages

# yum list
⇒ display packages that is possible to install
# yum list installed
⇒ display installed packages
check-update Check for available package updates

# yum check-update
info Display details about a package or group of packages

# yum info package
search Search package details for the given string

# yum search keyword
deplist List a package's dependencies

# yum deplist package

option
-y answer yes for all questions

# yum -y install package
--enablerepo=repo enable one or more repositories (wildcards allowed)

# yum --enablerepo=repo install package
--disablerepo=repo disable one or more repositories (wildcards allowed)

# yum --disablerepo=repo install package
--exclude=package exclude package(s) by name or glob

# yum --exclude=package update
--noplugins disable Yum plugins

# yum --noplugins update



zypper - command-line interface to ZYPP system management library
[SYNOPSIS] zypper OPTION1 COMMAND OPTION2 PACKAGE
command
install Install packages or resolvables

# zypper install package
update Update packages

# zypper update package
remove Remove packages or resolvables

# zypper remove package
search Search for packages matching a pattern

# zypper search keyword
source-install Install source packages

# zypper source-install package