編集の要約なし
 
(同じ利用者による、間の284版が非表示)
1行目: 1行目:
略語の意味を示すために説明は英語表記。ちなみに、これら全ては1つ1つがアプリだった。Unix哲学の結晶。
昔はこれら全て1つ1つが''アプリ''だった。粒度が小さく、基本的には役割分担が明確だったので Unix哲学の象徴だと言える。略語の意味を示すために説明は英語表記。


__TOC__
__TOC__


==デバイス管理==
==シェルコマンド==
 
{| class="wikitable" summary="シェルコマンド"
|-
!コマンド
!説明
|-
|<code><nowiki>!!</nowiki></code> || 直前に実行したコマンドを実行
|-
|<code>Ctrl</code> + <code>r</code> || 履歴を検索して実行
|-
|<code>CMD1 ; CMD2</code> || CMD1 を実行してから CMD2 を実行
|-
|<code>CMD1 && CMD2</code> || CMD1 の終了ステータスが「0」なら CMD2 を実行
|-
|<code><nowiki>CMD1 || CMD2</nowiki></code> || CMD1 の終了ステータスが「0」以外なら CMD2 を実行
|-
|<code><nowiki>CMD1 | CMD2</nowiki></code> || CMD1 の出力を、CMD2 の入力へと渡すパイプ
|-
|<code>></code>, <code>1></code> || 標準出力先を指定
|-
|<code>>></code> || 標準出力先を指定(追記)
|-
|<code>2></code> || 標準エラー出力先を指定
|-
|<code>&></code> || 標準出力先、標準エラー出力先の両方を指定
|-
|<code><< eof</code> || here document(EOF文字が出現するまでの内容を標準入力とする)
|-
|<code>vi /etc/profile</code> || 全ユーザに共通するシェル環境を設定
|}
 
==シェルスクリプト==
if test -f /home/lpicuser/lpic.sh
then
    /home/lpicuser/lpic.sh
else
    /home/lpicuser/default.sh
fi
 
* [[シェルスクリプト]] まとめ
 
==コピー&ペースト==
Linux では通常の「クリップボード」に加えて「X・プライマリ・セレクション」も利用できる。


* lscpu --- list CPU info
{| class="wikitable" summary="コピー&ペースト"
* lspci --- list PCI devices
|-
* lsusb --- lsit USB devices
!コマンド
* lsscsi --- list SCSI devices
!説明
* lsblk --- list block / storage devices
|-
* hwclock --- set hardware clock
|ハイライト + ホイールボタン
* hdparm --- show HDD/SATA/IDE parameters
|ハイライト部分を新規にペースト
* sdparm --- access SCSI mode page
|-
* loadkeys --- loadkeybords
|<code>[[xclip]]</code>
* setterm --- terminal settings
|clip to X-selections and clipboard
* screen --- terminal screen manager
|}
* tmux --- ?
* chvt --- change vertual terminal
* fdisk --- fixed disk, manipulate partitions
* parted --- partition edit
* partx --- show partitions
* mkswap --- make swap area
* swapon --- swap area on
* swapoff --- swap area off
* wodim --- write to CD/DVD
* growisofs --- write iso image to DVD


==カーネル管理==
==カーネル管理==


* mkinitramfs --- initramfs image generator ( Debian )
{| class="wikitable" summary="カーネル管理"
* dracut --- initramfs image generator ( RH )
|-
* dmsg --- display Kernel message ring
!コマンド
* lsmod --- list Linux Kernel modules
!説明
* insmod --- insert a Kernel module
|-
* rmmod --- remove a Kernel module
|<code>[[grub-mkconfig]]</code> || generate a GRUB configuration file
* depmod --- generate modules.dep
|-
* modprobe --- add and remove modules from Kernel
|<code>mkinitramfs</code> || initramfs image generator ( Debian )
* modinfo --- show information about a Kernel modules
|-
|<code>dracut</code> || initramfs image generator ( RH )
|-
|<code>dmesg</code> || display Kernel message ring
|-
|<code>lsmod</code> || list Linux Kernel modules
|-
|<code>modinfo</code> || show information about a Kernel modules
|-
|<code>insmod</code> || insert a Kernel module
|-
|<code>rmmod</code> || remove a Kernel module
|-
|<code>depmod</code> || generate modules.dep
|-
|<code>modprobe</code> || add and remove modules from Kernel
|}


==システム管理==
==デバイス管理==


* hostname --- hostname
{| class="wikitable" summary="デバイス管理"
* hostnamectl --- mamage hostname ( hostnamectl status )
|-
* uname --- show system information
!コマンド
* arch --- show system hardware name ( = uname -m)
!説明
* top --- show top processes
|-
* df --- disk free on filesystem
|<code>lscpu</code> || list CPU info
* du --- disk used
|-
* free --- free memory
|<code>[[dmidecode]]</code> || dumping a computer's DMI table contents
* vmstat --- memory status
|-
* init --- system mamager
|<code>free</code>
* initctl --- ?
|free memory
* systemctl --- system mamager
|-
* chkconfig --- old way of systemctl
|<code>vmstat</code>
* runlevel --- show runlevel
|virtual memory statistics
* update-rc.d --- set System-V initial links
|-
* sysctl --- configure Kernel parameters
|<code>[[lsblk]]</code> || list storage, partition infomation
* ldd --- list dynamic dependencies
|-
* ldconfig --- ldd configure
|<code>[[df]]</code>
* logger --- enter message to system log
|disk free on filesystem
* journalctl --- system log manager
|-
* halt --- halt, power off, reboot machine
|<code>[[du]]</code>
* shutdown --- shutdown machine
|disk used on directory
* busybox --- command tool box
|-
|<code>[[lspci]]</code> || list Peripheral Component Interconnect devices
|-
|<code>lsusb</code> || lsit USB devices
|-
|<code>lsscsi</code> || list SCSI devices
|-
|<code>[[hwclock]]</code> || set hardware clock
|-
|<code>hdparm</code> || show HDD/SATA/IDE parameters
|-
|<code>sdparm</code> || access SCSI mode page
|-
|<code>loadkeys</code> || loadkeybords
|-
|<code>wodim</code> || write to CD/DVD
|-
|<code>growisofs</code> || write iso image to DVD
|}


==プロセス管理==
==パーティション管理==


* pwdx --- pwd for process
{| class="wikitable" summary="パーティション管理"
* ps --- show processes
|-
* pstree --- show processes tree
!コマンド
* pgrep --- process grep
!説明
* pkill --- process kill
|-
* pidof --- process id open file
|<code>[[fdisk]]</code> || fixed disk. manipulate disk partition table
* lsof --- list files opened by processes
|-
* fuser --- identify file opening process
|<code>gdisk</code> || GUID Partition Table (GPT) manipulator
* kill --- kill process
|-
* nohup --- run command without hup
|<code>parted</code> || a partition edit program
* jobs --- show working jobs
|-
* bg --- doing job at background
|<code>gparted</code> || GNU partition edit program
* fg --- doing job at forgraound
|-
|<code>partx</code> || show partitions
|-
|<code>mkswap</code> || make a Linux swap area
|-
|<code>[[swapon]]</code> || enable devices and files for swapping
|-
|<code>swapoff</code> ||  disable devices and files for swapping
|}


==ファイルシステム管理==
==ファイルシステム管理==


* mkfs --- make file system
{| class="wikitable" summary="ファイルシステム管理"
* fsck --- file system check
|-
* mount --- mount file system
!コマンド
* umount --- unmount file system
!説明
* mknod --- create a special file
|-
|<code>[[mke2fs]]</code>
|make an ext2/ext3/ext4 filesystem
|-
|<code>[[tune2fs]]</code>
|adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems
|-
|<code>[[e2fsck]]</code>
|check a Linux ext2/ext3/ext4 file system
|-
|<code>[[mkfs]]</code>
|make a Linux filesystem
|-
|<code>fsck</code>
|file system check
|-
|<code>debugfs</code>
|ext2/ext3/ext4 file system debugger
|-
|<code>[[mount]]</code>
|mount a filesystem
|-
|<code>umount</code>
|unmount a filesystem
|}
 
==システム管理==
 
{| class="wikitable" summary="システム管理"
|-
!コマンド
!説明
|-
|<code>[[systemctl]]</code>
|system mamager
|-
|<code>screen</code> || terminal screen manager
|-
|<code>setterm</code> || terminal settings
|-
|<code>tmux</code> || ?
|-
|<code>chvt</code> || change vertual terminal
|-
|<code>uptime</code>
|Tell how long the system has been running.
|-
|<code>[[uname]]</code>
|show system information
|-
|<code>arch</code>
|( = uname -m) show system hardware name
|-
|<code>[[hostname]]</code>
|hostname
|-
|<code>[[hostnamectl]]</code>
|mamage hostname
|-
|<code>init</code>
|system mamager
|-
|<code>initctl</code>
|?
|-
|<code>chkconfig</code>
|old way of systemctl
|-
|<code>runlevel</code>
|show runlevel
|-
|<code>update-rc.d</code>
|set System-V initial links
|-
|<code>[[sysctl]]</code>
|configure Kernel parameters
|-
|<code>[[ldd]]</code>
|Library DepenDencies
|-
|<code>ldconfig</code>
|ldd configure
|-
|<code>logger</code>
|enter message to system log
|-
|<code>journalctl</code>
|system log manager
|-
|<code>halt</code>
|halt, power off, reboot machine
|-
|<code>[[shutdown]]</code>
|shutdown machine
|-
|<code>which</code>
|locate a command
|-
|<code>whereis</code>
|locate the binary, source, and manual page files for a command
|-
|<code>busybox</code>
|command tool box
|-
|}
 
==プロセス管理==
 
{| class="wikitable" summary="プロセス管理"
|-
!コマンド
!説明
|-
|<code>[[top]]</code>
|( = htop ) show top processes
|-
|<code>[[pstree]]</code>
|show machine's running processes as tree
|-
|<code>[[ps]]</code>
|show machine's running processes
|-
|<code>[[pgrep]]</code>
|process grep. look up PID using process's name
|-
|<code>pkill</code>
|kill processes by name and other attributes
|-
|<code>killall</code>
|kill all processes by name
|-
|<code>[[kill]]</code>
|kill process by PID
|-
|<code>[[nice]]</code>
|set program priority
|-
|<code>[[renice]]</code>
|alter program priority
|-
|<code>[[lsof]]</code>
|list files opened by processes
|-
|<code>pidof</code>
|process id open file
|-
|<code>fuser</code>
|identify file opening process
|-
|<code>pwdx</code>
|pwd for process
|-
|<code>jobs</code>
|show working jobs
|-
|<code>bg</code>
|doing job at background
|-
|<code>fg</code>
|doing job at forgraound
|-
|<code>nohup</code>
|run command without logout hang up
|}


==ユーザ管理==
==ユーザ管理==


* last --- show recent log-in users
{| class="wikitable" summary="ユーザ管理"
* lastlog --- show last users login
|-
* w / who --- show logged-in users
!コマンド
* users --- show logged-in users
!説明
* useradd --- add a user ( useradd -m -s /bin/bash -G sudo hoge )
|-
* userdel --- delete a user ( userdel -r hoge )
|<code>last</code>
* usermod --- modify a user
|show a listing of last logged in users
* groups --- show user's groups
|-
* groupadd --- add a group
|<code>lastlog</code>
* groupdel --- delete a group
|all users' the most recent login
* groupmod --- modify a group
|-
* chage --- change / show user's age
|<code>w / who</code>
* chsh --- change login shell
|show logged-in users
* finger --- user's fingerprint
|-
* chfn --- change user's fingerprint
|<code>users</code>
* passwd --- change user's password
|show logged-in users
* gpasswd --- manage group password
|-
* chpasswd --- change password in batch mode
|<code>groups</code>
* pwck --- check password file
|show user's groups
* grpck --- check group file
|-
* vipw / vigr --- edit password / group file
|<code>[[useradd]]</code>
* pwconv --- convert password file
|add a user ( useradd -m -s /bin/bash -G sudo hoge )
* edquota --- edit quota for user disk
|-
* write / wall --- write a massage to all users
|<code>[[usermod]]</code>
* htpasswd --- httpd basic authentication
|modify a user
* htdigest --- httpd digest authentication
|-
|<code>[[userdel]]</code>
|delete a user
|-
|<code>groupadd</code>
|add a group
|-
|<code>groupmod</code>
|modify a group
|-
|<code>groupdel</code>
|delete a group
|-
|<code>[[getent]]</code>
|get entries from nsswitch.conf
|-
|<code>[[passwd]]</code>
|set or change user's password
|-
|<code>gpasswd</code>
|manage group password
|-
|<code>newgrp</code>
|log in to a new group
|-
|<code>chpasswd</code>
|change password in batch mode
|-
|<code>[[chage]]</code>
|change / show user's account and password age
|-
|<code>[[chsh]]</code>
|change login shell
|-
|<code>pwck</code>
|check password file
|-
|<code>finger</code>
|user's fingerprint
|-
|<code>chfn</code>
|change user's fingerprint
|-
|<code>grpck</code>
|check group file
|-
|<code>vipw / vigr</code>
|edit password / group file
|-
|<code>pwconv</code>
|convert password file
|-
|<code>quota</code>
|show user and group quota of strage
|-
|<code>repquota</code>
|show quota status
|-
|<code>quotaon</code>
|activate quota
|-
|<code>edquota</code>
|edit quota for user disk
|-
|<code>write / wall</code>
|write a massage to all users
|-
|<code>htpasswd</code>
|httpd basic authentication
|-
|<code>htdigest</code>
|httpd digest authentication
|-
|}


==ユーザツール==
==ユーザツール==


* id --- show user's id
{| class="wikitable" summary="ユーザツール"
* whoami --- who am i ?
|-
* [[date]] --- show date
!コマンド
* cal --- show calendar
!説明
* [[set]] --- show shell environment
|-
* env --- show user's enviroment
|<code>id</code>
* printenv --- show environment
|show user's id
* export --- export environment from shell's env to user's env
|-
* [[history]] --- show command history
|<code>whoami</code>
* alias / unalias --- make alias
|who am i ?
* fc  --- ?
|-
* su --- switch user
|<code>[[date]]</code>
* sudo --- switch user do
|show date
* sg --- switch group
|-
* chroot --- run command with special root directory
|<code>tzselect</code>
* nice --- set program priority
|select timezone
* renice --- alter program priority
|-
* crontab --- manage cron
|<code>timedatectl</code>
* expect --- expect response
|Control the system time and date
* at --- ?
|-
* script --- ?
|<code>cal</code>
* stdbuf --- modify buffering
|show calendar
* time --- show round trip time
|-
* watch --- run program periodically
|<code>[[set]]</code>
* sleep --- set a moment before run
|show shell environment. set >> env
* exit --- exit terminal
|-
* make --- compile file
|<code>[[unset]]</code>
* [[install]] --- copy files
|unset shell environment
* yes --- always say "yes"
|-
* git --- git
|<code>env</code>
* cvs --- cvs
|show user's enviroment
* svn --- svn
|-
* mysql --- mysql client / server
|<code>printenv</code>
* mysqldump --- mysql dump databases
|(= env) show environment
* xl --- ?
|-
* VBoxManage --- ?
|<code>[[locale]]</code>
* lpadmin --- configure cups printers
|get locale-specific information
* lpstat --- show cups printing status
|-
* lp --- submit files for printing
|<code>[[export]]</code>
* lpr --- subimt files for printing
|export environment from shell's env to user's env
* cancel --- cancel printing job
|-
|<code>[[history]]</code>
|show command history
|-
|<code>alias</code>
|make alias
|-
|<code>unalias</code>
|unmake alias
|-
|<code>fc</code>
|?
|-
|<code>su</code>
|switch user
|-
|<code>sudo</code>
|switch user do
|-
|<code>sg</code>
|switch group
|-
|<code>chroot</code>
|run command with special root directory
|-
|<code>[[crontab]]</code>
|manage cron
|-
|<code>expect</code>
|expect response
|-
|<code>at</code>
|?
|-
|<code>script</code>
|?
|-
|<code>stdbuf</code>
|modify buffering
|-
|<code>time</code>
|show round trip time
|-
|<code>watch</code>
|run program periodically
|-
|<code>sleep</code>
|set a moment before run
|-
|<code>exit</code>
|exit terminal
|-
|<code>make</code>
|compile file
|-
|<code>[[install]]</code>
|copy files
|-
|<code>yes</code>
|always say "yes"
|-
|<code>xargs</code>
|x-arguments
|-
|<code>git</code>
|git
|-
|<code>cvs</code>
|cvs
|-
|<code>svn</code>
|svn
|-
|<code>mysql</code>
|mysql client / server
|-
|<code>mysqldump</code>
|mysql dump databases
|-
|<code>xl</code>
|?
|-
|<code>VBoxManage</code>
|?
|-
|<code>lpadmin</code>
|configure cups printers
|-
|<code>lpstat</code>
|show cups printing status
|-
|<code>lp</code>
|submit files for printing
|-
|<code>lpr</code>
|subimt files for printing
|-
|<code>cancel</code>
|cancel printing job
|-
|}


==ファイル / ディレクトリ操作==
==ファイル / ディレクトリ操作==


* pwd --- print working directory
{| class="wikitable" summary="ファイル / ディレクトリ操作"
* tree --- show tee-style directory
|-
* find --- find files
!コマンド
* locate --- location of files
!説明
* xargs --- x-arguments
|-
* which --- command path
|<code>pwd</code>
* ls --- list
|print working directory
* file --- type of file
|-
* stat --- status of file
|<code>tree</code>
* lsattr --- file system attribution
|show tee-style directory
* chattr --- change file system attribution
|-
* chmod --- change mode
|<code>[[ls]]</code>
* chown --- change owner of file
|list
* chgrp --- change owner group
|-
* cd --- change directory
|<code>cd</code>
* [[cp]] --- copy
|change directory
* [[mv]] --- move, change
|-
* rm --- remove
|<code>[[find]]</code>
* shred --- shred files
|find files
* tmpwatch --- ?
|-
* umask --- user mask
|<code>locate</code>
* [[mkdir]] --- make a directory
|location of files
* rmdir --- remove direcotory
|-
* touch --- touch a file
|<code>updatedb</code>
* ln --- make a link
|update database for locate
* readlink --- show symbolic link
|-
* basename --- base name of file
|<code>basename</code>
* dirname --- name of directory
|base name of file
* split --- split a file
|-
* truncate --- shrink or expand file
|<code>dirname</code>
* tar --- type archive
|name of directory
* gzip / gunzip --- zip / unzip
|-
* cpio --- extract rpm files
|<code>file</code>
* mktemp --- make temporary file
|show types of files
* convmv --- convert move
|-
* dd --- dump datas
|<code>stat</code>
* pv --- pipe viewer
|status of file
* base64 --- base64 encode / decode
|-
* od --- octal dump
|<code>lsattr</code>
* md5sum / sha1sum --- calculate md5 or sha1
|list file attributes on a Linux second extended file system
* iconv --- change file encoding
|-
* strings --- show string parts in data file
|<code>[[chattr]]</code>
* uuencode --- ?
|change file attribution
* uudecode --- ?
|-
* lhasa --- ?
|<code>[[chmod]]</code>
* unrar --- ?
|change mode
* pushd --- ?
|-
|<code>chown</code>
|change owner of file
|-
|<code>chgrp</code>
|change owner group
|-
|<code>[[mkdir]]</code>
|make a directory
|-
|<code>rmdir</code>
|remove direcotory
|-
|<code>touch</code>
|touch a file
|-
|<code>[[cp]]</code>
|copy
|-
|<code>[[mv]]</code>
|move, change
|-
|<code>[[rm]]</code>
|remove
|-
|<code>shred</code>
|shred files
|-
|<code>[[ln]]</code>
|make links between files
|-
|<code>readlink</code>
|show symbolic link
|-
|<code>tmpwatch</code>
|?
|-
|<code>[[umask]]</code>
|user mask
|-
|<code>[[split]]</code>
|split a file into pieces. 1,000 rows chunk as default
|-
|<code>truncate</code>
|shrink or expand file
|-
|<code>[[tar]]</code>
|type archive
|-
|<code>[[cpio]]</code>
|(= tar) copy files to and from archives
|-
|<code>gzip / gunzip</code>
|zip / unzip
|-
|<code>mktemp</code>
|make temporary file
|-
|<code>convmv</code>
|convert move
|-
|<code>[[dd]]</code>
|dump datas
|-
|<code>pv</code>
|pipe viewer
|-
|<code>base64</code>
|base64 encode / decode
|-
|<code>[[od]]</code>
|dump files in octal and other formats
|-
|<code>md5sum / sha1sum</code>
|calculate md5 or sha1
|-
|<code>[[iconv]]</code>
|change file encoding
|-
|<code>strings</code>
|show string parts in data file
|-
|<code>uuencode</code>
|?
|-
|<code>uudecode</code>
|?
|-
|<code>lhasa</code>
|?
|-
|<code>unrar</code>
|?
|-
|<code>pushd</code>
|?
|-
|}


==テキスト編集==
==テキスト操作==


* echo --- display a line of text
{| class="wikitable" summary="テキスト操作"
* tee --- write std-output and life
|-
* more --- viewer
!コマンド
* less --- viewer
!説明
* head --- show head part of file  
|-
* tail / tailf --- show tail part of file
|<code>[[echo]]</code>
* cat --- concatinate
|display a line of text
* nl --- with number line
|-
* rev --- reverse
|<code>[[tee]]</code>
* grep --- global reguler expression print
|write std-output and life
* [[vi]] --- visual editor
|-
* ex --- ex mode of vi
|<code>more</code>
* ed --- line editor
|viewer
* sed --- stream editor
|-
* tr --- translate
|<code>[[less]]</code>
* awk --- patter scanning and processing language
|viewer
* nkf --- ?
|-
* patch --- patch a diff file
|<code>head</code>
* diff --- compare two files line by line
|show head part of file
* comm --- compare two files line by line
|-
* cmp --- compare two files byte by byte
|<code>tail / tailf</code>
* col --- remove \n etc.
|show tail part of file
* column --- columnate list
|-
* colrm --- column remove
|<code>[[cat]]</code>
* cut --- cut
|concatinate
* expand --- expand tab to space
|-
* unexpand --- space to tab
|<code>tac</code>
* paste --- marge files
|etanitacnoc
* join --- marge same parts of files
|-
* uniq --- show only uniq part
|<code>nl</code>
* wc --- word count
|with number line
* seq --- sequence
|-
* sort --- sort
|<code>[[grep]]</code>
* bc --- calculator
|global reguler expression print
* let --- calculate
|-
* factor --- show factor numbers
|<code>uniq</code>
* expr --- evaluate expression
|show only uniq part
* test --- ?
|-
* shuf --- shuffle some value
|<code>[[wc]]</code>
* fold --- wrap words in lines
|word count
* pr --- for printer format
|-
|<code>[[cut]]</code>
|cut
|-
|<code>rev</code>
|reverse
|-
|<code>seq</code>
|sequence
|-
|<code>[[sort]]</code>
|sort lines of text files
|-
|<code>[[tr]]</code>
|translate or delete characters
|-
|<code>ex</code>
|ex mode of vi
|-
|<code>ed</code>
|line editor (Ken Thompson)
|-
|<code>[[sed]]</code>
|stream editor
|-
|<code>[[vi]]</code>
|visual editor
|-
|<code>awk</code>
|patter scanning and processing language
|-
|<code>nkf</code>
|?
|-
|<code>patch</code>
|patch a diff file
|-
|<code>diff</code>
|compare two files line by line
|-
|<code>comm</code>
|compare two files line by line
|-
|<code>cmp</code>
|compare two files byte by byte
|-
|<code>col</code>
|remove \n etc.
|-
|<code>column</code>
|columnate list
|-
|<code>colrm</code>
|column remove
|-
|<code>expand</code>
|expand tab to space
|-
|<code>unexpand</code>
|space to tab
|-
|<code>paste</code>
|marge files
|-
|<code>join</code>
|marge same parts of files
|-
|<code>bc</code>
|calculator
|-
|<code>let</code>
|calculate
|-
|<code>factor</code>
|show factor numbers
|-
|<code>expr</code>
|evaluate expression
|-
|<code>test</code>
|?
|-
|<code>shuf</code>
|shuffle some value
|-
|<code>fold</code>
|wrap words in lines
|-
|<code>pr</code>
|for printer format
|-
|}


==パッケージ管理==
==パッケージ管理==


* apt --- advanced packaging tool
{| class="wikitable" summary="パッケージ管理"
* dpkg --- Debian package manager
|-
* yum --- yellodog-linux update manager
!コマンド
* rpm --- RedHat package manager
!説明
* rpm2cpio --- rpm file to cpio
|-
|<code>apt</code>
|advanced packaging tool
|-
|<code>[[dpkg]]</code>
|Debian package manager
|-
|<code>dpkg-reconfigure</code>
|reconfigure an already installed package
|-
|<code>[[yum]]</code>
|yellodog-linux update manager
|-
|<code>rpm</code>
|RedHat package manager
|-
|<code>rpm2cpio</code>
|rpm file to cpio
|-
|}


==ネットワーク==
==ネットワーク==


* ss --- show sockets
{| class="wikitable" summary="ネットワーク"
* netstat --- network status
|-
* arp --- ip neighbors
!コマンド
* ipcalc --- ip calculator
!説明
* ip --- internet protocol mnager
|-
* route --- ip routing table manager
|<code>[[netstat]]</code>
* ifconfig --- interface configure
|network status
* iwconfig --- interface wireless configure
|-
* iwlist --- show Wi-Fi access-point
|<code>[[ss]]</code>
* nmtui --- NetworkManager text-user interface
|show sockets
* nmcli --- NetworkManager command-line interface
|-
* iptables --- packet filtering tool
|<code>arp</code>
* firewall-cmd --- firewall manager
|ip neighbors
* ufw --- uncomplicated firewall manager
|-
* wpa_supplicant --- protected Wi-Fi cliant
|<code>ipcalc</code>
* ping --- send ICMP ECHO_REQUEST
|ip calculator
* tracepath --- show a path to the host
|-
* arping --- send ARP REQUEST to neighber
|<code>route</code>
* ntpq --- NTP quary
|ip routing table manager
* ntpdate --- set the date via NTP
|-
* clockdiff --- time lag to remote host
|<code>[[ip]]</code>
* telnet --- ?
|internet protocol mnager
* ssh --- secure shell
|-
* ssh-keygen --- ssh-key generator
|<code>[[ifconfig]]</code>
* ssh-copy-id --- ssh copy id
|interface configure
* scp --- secure copy
|-
* rsync --- remote file-copying tool
|<code>iwconfig</code>
* ftp --- file transfer program
|interface wireless configure
* sftp --- secure ftp
|-
* wget --- WWW downloader
|<code>iwlist</code>
* curl --- Client URL Request Library
|show Wi-Fi access-point
* tcpdump --- dump traffic on a network
|-
* tshark --- ?
|<code>wpa_supplicant</code>
* brctl --- ?
|protected Wi-Fi cliant
* host --- DNS lookup
|-
* nslookup --- DNS lookup
|<code>nmtui</code>
* dig --- DNS lookup
|NetworkManager text-user interface
* whois --- show IANA info
|-
|<code>nmcli</code>
|NetworkManager command-line interface
|-
|<code>iptables</code>
|packet filtering tool
|-
|<code>ufw</code>
|uncomplicated firewall manager
|-
|<code>firewall-cmd</code>
|firewall manager
|-
|<code>[[ping]]</code>
|send ICMP ECHO_REQUEST
|-
|<code>[[traceroute]]</code>
|print the route packets trace to network host
|-
|<code>arping</code>
|send ARP REQUEST to neighber
|-
|<code>ntpq</code>
|NTP quary
|-
|<code>ntpdate</code>
|set the date via NTP
|-
|<code>clockdiff</code>
|time lag to remote host
|-
|<code>ssh</code>
|secure shell
|-
|<code>ssh-keygen</code>
|ssh-key generator
|-
|<code>ssh-copy-id</code>
|ssh copy id
|-
|<code>scp</code>
|secure copy
|-
|<code>rsync</code>
|remote file-copying tool
|-
|<code>telnet</code>
|?
|-
|<code>ftp</code>
|file transfer program
|-
|<code>sftp</code>
|secure ftp
|-
|<code>wget</code>
|WWW downloader
|-
|<code>curl</code>
|Client URL Request Library
|-
|<code>tcpdump</code>
|dump traffic on a network
|-
|<code>tshark</code>
|?
|-
|<code>brctl</code>
|?
|-
|<code>[[host]]</code>
|DNS lookup
|-
|<code>nslookup</code>
|DNS lookup
|-
|<code>[[dig]]</code>
|DNS lookup
|-
|<code>whois</code>
|show IANA info
|-
|}


==ネットワークセキュリティ==
==ネットワークセキュリティ==


* nmap --- Network Mapper
{| class="wikitable" summary="ネットワークセキュリティ"
* netcat / nc --- network investigator
|-
* gpg --- GNU Privacy Gard
!コマンド
* openssl --- SSL / TLS tool kit
!説明
* pwgen --- password generator
|-
|<code>nmap</code>
|Network Mapper
|-
|<code>netcat / nc</code>
|network investigator
|-
|<code>[[gpg]]</code>
|OpenPGP encryption and signing tool
|-
|<code>openssl</code>
|SSL / TLS tool kit
|-
|<code>pwgen</code>
|password generator
|-
|}


==ネットワークツール==
==ネットワークツール==


* mail --- send and receive mail
{| class="wikitable" summary="ネットワークツール"
* mailq --- ?
|-
* newaliases --- mail alias
!コマンド
* w3m --- WWW monitor
!説明
* showmount --- show NFS server's exports status
|-
* rdesktop --- remote desktop
|<code>mail</code>
|send and receive mail
|-
|<code>mailq</code>
|?
|-
|<code>newaliases</code>
|mail alias
|-
|<code>w3m</code>
|WWW monitor
|-
|<code>showmount</code>
|show NFS server's exports status
|-
|<code>rdesktop</code>
|remote desktop
|-
|}
 
==TIPS==
===画像を一括して圧縮===
# find /var/www/html/wp-content/uploads/ -name *.jpg | xargs -t -I{} convert {} -sampling-factor 4:2:0 -strip -quality 90 -interlace JPEG -colorspace sRGB {}
* root が<code>/etc/</code>に nologinファイルを作成すると全ての一般ユーザがログイン不可になる。ファイルに内容を記載した場合は、それがログイン拒否時に表示される

2022年11月29日 (火) 23:35時点における最新版

昔はこれら全て1つ1つがアプリだった。粒度が小さく、基本的には役割分担が明確だったので Unix哲学の象徴だと言える。略語の意味を示すために説明は英語表記。

シェルコマンド

コマンド 説明
!! 直前に実行したコマンドを実行
Ctrl + r 履歴を検索して実行
CMD1 ; CMD2 CMD1 を実行してから CMD2 を実行
CMD1 && CMD2 CMD1 の終了ステータスが「0」なら CMD2 を実行
CMD1 || CMD2 CMD1 の終了ステータスが「0」以外なら CMD2 を実行
CMD1 | CMD2 CMD1 の出力を、CMD2 の入力へと渡すパイプ
>, 1> 標準出力先を指定
>> 標準出力先を指定(追記)
2> 標準エラー出力先を指定
&> 標準出力先、標準エラー出力先の両方を指定
<< eof here document(EOF文字が出現するまでの内容を標準入力とする)
vi /etc/profile 全ユーザに共通するシェル環境を設定

シェルスクリプト

if test -f /home/lpicuser/lpic.sh
then
    /home/lpicuser/lpic.sh
else
    /home/lpicuser/default.sh
fi

コピー&ペースト

Linux では通常の「クリップボード」に加えて「X・プライマリ・セレクション」も利用できる。

コマンド 説明
ハイライト + ホイールボタン ハイライト部分を新規にペースト
xclip clip to X-selections and clipboard

カーネル管理

コマンド 説明
grub-mkconfig generate a GRUB configuration file
mkinitramfs initramfs image generator ( Debian )
dracut initramfs image generator ( RH )
dmesg display Kernel message ring
lsmod list Linux Kernel modules
modinfo show information about a Kernel modules
insmod insert a Kernel module
rmmod remove a Kernel module
depmod generate modules.dep
modprobe add and remove modules from Kernel

デバイス管理

コマンド 説明
lscpu list CPU info
dmidecode dumping a computer's DMI table contents
free free memory
vmstat virtual memory statistics
lsblk list storage, partition infomation
df disk free on filesystem
du disk used on directory
lspci list Peripheral Component Interconnect devices
lsusb lsit USB devices
lsscsi list SCSI devices
hwclock set hardware clock
hdparm show HDD/SATA/IDE parameters
sdparm access SCSI mode page
loadkeys loadkeybords
wodim write to CD/DVD
growisofs write iso image to DVD

パーティション管理

コマンド 説明
fdisk fixed disk. manipulate disk partition table
gdisk GUID Partition Table (GPT) manipulator
parted a partition edit program
gparted GNU partition edit program
partx show partitions
mkswap make a Linux swap area
swapon enable devices and files for swapping
swapoff disable devices and files for swapping

ファイルシステム管理

コマンド 説明
mke2fs make an ext2/ext3/ext4 filesystem
tune2fs adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems
e2fsck check a Linux ext2/ext3/ext4 file system
mkfs make a Linux filesystem
fsck file system check
debugfs ext2/ext3/ext4 file system debugger
mount mount a filesystem
umount unmount a filesystem

システム管理

コマンド 説明
systemctl system mamager
screen terminal screen manager
setterm terminal settings
tmux ?
chvt change vertual terminal
uptime Tell how long the system has been running.
uname show system information
arch ( = uname -m) show system hardware name
hostname hostname
hostnamectl mamage hostname
init system mamager
initctl ?
chkconfig old way of systemctl
runlevel show runlevel
update-rc.d set System-V initial links
sysctl configure Kernel parameters
ldd Library DepenDencies
ldconfig ldd configure
logger enter message to system log
journalctl system log manager
halt halt, power off, reboot machine
shutdown shutdown machine
which locate a command
whereis locate the binary, source, and manual page files for a command
busybox command tool box

プロセス管理

コマンド 説明
top ( = htop ) show top processes
pstree show machine's running processes as tree
ps show machine's running processes
pgrep process grep. look up PID using process's name
pkill kill processes by name and other attributes
killall kill all processes by name
kill kill process by PID
nice set program priority
renice alter program priority
lsof list files opened by processes
pidof process id open file
fuser identify file opening process
pwdx pwd for process
jobs show working jobs
bg doing job at background
fg doing job at forgraound
nohup run command without logout hang up

ユーザ管理

コマンド 説明
last show a listing of last logged in users
lastlog all users' the most recent login
w / who show logged-in users
users show logged-in users
groups show user's groups
useradd add a user ( useradd -m -s /bin/bash -G sudo hoge )
usermod modify a user
userdel delete a user
groupadd add a group
groupmod modify a group
groupdel delete a group
getent get entries from nsswitch.conf
passwd set or change user's password
gpasswd manage group password
newgrp log in to a new group
chpasswd change password in batch mode
chage change / show user's account and password age
chsh change login shell
pwck check password file
finger user's fingerprint
chfn change user's fingerprint
grpck check group file
vipw / vigr edit password / group file
pwconv convert password file
quota show user and group quota of strage
repquota show quota status
quotaon activate quota
edquota edit quota for user disk
write / wall write a massage to all users
htpasswd httpd basic authentication
htdigest httpd digest authentication

ユーザツール

コマンド 説明
id show user's id
whoami who am i ?
date show date
tzselect select timezone
timedatectl Control the system time and date
cal show calendar
set show shell environment. set >> env
unset unset shell environment
env show user's enviroment
printenv (= env) show environment
locale get locale-specific information
export export environment from shell's env to user's env
history show command history
alias make alias
unalias unmake alias
fc ?
su switch user
sudo switch user do
sg switch group
chroot run command with special root directory
crontab manage cron
expect expect response
at ?
script ?
stdbuf modify buffering
time show round trip time
watch run program periodically
sleep set a moment before run
exit exit terminal
make compile file
install copy files
yes always say "yes"
xargs x-arguments
git git
cvs cvs
svn svn
mysql mysql client / server
mysqldump mysql dump databases
xl ?
VBoxManage ?
lpadmin configure cups printers
lpstat show cups printing status
lp submit files for printing
lpr subimt files for printing
cancel cancel printing job

ファイル / ディレクトリ操作

コマンド 説明
pwd print working directory
tree show tee-style directory
ls list
cd change directory
find find files
locate location of files
updatedb update database for locate
basename base name of file
dirname name of directory
file show types of files
stat status of file
lsattr list file attributes on a Linux second extended file system
chattr change file attribution
chmod change mode
chown change owner of file
chgrp change owner group
mkdir make a directory
rmdir remove direcotory
touch touch a file
cp copy
mv move, change
rm remove
shred shred files
ln make links between files
readlink show symbolic link
tmpwatch ?
umask user mask
split split a file into pieces. 1,000 rows chunk as default
truncate shrink or expand file
tar type archive
cpio (= tar) copy files to and from archives
gzip / gunzip zip / unzip
mktemp make temporary file
convmv convert move
dd dump datas
pv pipe viewer
base64 base64 encode / decode
od dump files in octal and other formats
md5sum / sha1sum calculate md5 or sha1
iconv change file encoding
strings show string parts in data file
uuencode ?
uudecode ?
lhasa ?
unrar ?
pushd ?

テキスト操作

コマンド 説明
echo display a line of text
tee write std-output and life
more viewer
less viewer
head show head part of file
tail / tailf show tail part of file
cat concatinate
tac etanitacnoc
nl with number line
grep global reguler expression print
uniq show only uniq part
wc word count
cut cut
rev reverse
seq sequence
sort sort lines of text files
tr translate or delete characters
ex ex mode of vi
ed line editor (Ken Thompson)
sed stream editor
vi visual editor
awk patter scanning and processing language
nkf ?
patch patch a diff file
diff compare two files line by line
comm compare two files line by line
cmp compare two files byte by byte
col remove \n etc.
column columnate list
colrm column remove
expand expand tab to space
unexpand space to tab
paste marge files
join marge same parts of files
bc calculator
let calculate
factor show factor numbers
expr evaluate expression
test ?
shuf shuffle some value
fold wrap words in lines
pr for printer format

パッケージ管理

コマンド 説明
apt advanced packaging tool
dpkg Debian package manager
dpkg-reconfigure reconfigure an already installed package
yum yellodog-linux update manager
rpm RedHat package manager
rpm2cpio rpm file to cpio

ネットワーク

コマンド 説明
netstat network status
ss show sockets
arp ip neighbors
ipcalc ip calculator
route ip routing table manager
ip internet protocol mnager
ifconfig interface configure
iwconfig interface wireless configure
iwlist show Wi-Fi access-point
wpa_supplicant protected Wi-Fi cliant
nmtui NetworkManager text-user interface
nmcli NetworkManager command-line interface
iptables packet filtering tool
ufw uncomplicated firewall manager
firewall-cmd firewall manager
ping send ICMP ECHO_REQUEST
traceroute print the route packets trace to network host
arping send ARP REQUEST to neighber
ntpq NTP quary
ntpdate set the date via NTP
clockdiff time lag to remote host
ssh secure shell
ssh-keygen ssh-key generator
ssh-copy-id ssh copy id
scp secure copy
rsync remote file-copying tool
telnet ?
ftp file transfer program
sftp secure ftp
wget WWW downloader
curl Client URL Request Library
tcpdump dump traffic on a network
tshark ?
brctl ?
host DNS lookup
nslookup DNS lookup
dig DNS lookup
whois show IANA info

ネットワークセキュリティ

コマンド 説明
nmap Network Mapper
netcat / nc network investigator
gpg OpenPGP encryption and signing tool
openssl SSL / TLS tool kit
pwgen password generator

ネットワークツール

コマンド 説明
mail send and receive mail
mailq ?
newaliases mail alias
w3m WWW monitor
showmount show NFS server's exports status
rdesktop remote desktop

TIPS

画像を一括して圧縮

# find /var/www/html/wp-content/uploads/ -name *.jpg | xargs -t -I{} convert {} -sampling-factor 4:2:0 -strip -quality 90 -interlace JPEG -colorspace sRGB {}
  • root が/etc/に nologinファイルを作成すると全ての一般ユーザがログイン不可になる。ファイルに内容を記載した場合は、それがログイン拒否時に表示される