0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[linux] よく忘れるコマンドメモ

Last updated at Posted at 2020-02-27

環境

zsh

パイプコマンド

alias -g A='| awk'
alias -g C='| pbcopy'
alias -g G='| grep --color=auto'
alias -g H='| head'
alias -g S='| sort'
alias -g T='| tail'
alias -g L='| less -iMR'
alias -g X='| xargs'

ファイル容量を確認

ncduをインストールする

apt install ncdu

これが一番早いし楽だし便利
df,duコマンドはだるすぎる

システム全体

df

カレントディレクトリ (1階層)

du -sh ${pwd}

カレントディレクトリ (全階層)

du -Sh ${pwd}

小文字の s: 1階層
大文字の S: 全階層
-h: サイズ順

alias設定
alias size='echo '全階層のサイズ一覧' && du -Sh ${pwd}* | sort -h'
alias size1='echo '1階層のサイズ一覧' && du -sh ${pwd}* | sort -h'

ユーザーをグループへ追加

sudo adduser username groupname   

ユーザ情報

who
whoami
${whoami}
-a, --all -b -d --login -p -r -t -T -u と同じ -b, --boot 最後にシステムが起動した時刻 -d, --dead 終了したプロセスを表示 -H, --heading ヘッダ行を表示 --ips print ips instead of hostnames. with --lookup, canonicalizes based on stored IP, if available, rather than stored hostname -l, --login システムのログインプロセスを表示する --lookup 正式なホスト名を DNS から取得するように試みる -m 標準入力に関連づけられたホスト名とユーザのみを表示する -p, --process init によって起動されたアクティブプロセスを表示する -q, --count ログイン中のユーザーのログイン名とユーザ数 -r, --runlevel 現在のランレベルを表示 -s, --short 名前, 行および時間のみを表示 (標準) -t, --time 最後にシステムの時刻が変更された時刻を表示 -T, -w, --mesg ユーザーのメッセージ状態を +, - または ? で追記 -u, --users ログイン中のユーザを一覧

バージョン確認

cat /etc/os-release

権限

-Rオプションをつけるととディレクトリ配下全てまるごと変更になる

chmod: (change mode)

ファイルやディレクトリのアクセス権を変更する

chmod 755 data
chmod -R 755 data
r 4 読み込み権限
w 2 書き込み権限
x 1 実行権限

chown: (change owner)

ファイルやディレクトリの所有者を変更する

chown username data
chown -R username data

chgrp: (change group)

ファイルやディレクトリのグループを変更する

chgrp usergroup data
chgrp -R usergroup data

フォント

fc-cache -Ev
fc-cache -fv
-E, --error-on-no-fonts raise an error if no fonts in a directory -f, --force scan directories with apparently valid caches -r, --really-force erase all existing caches, then rescan -s, --system-only scan system-wide directories only -y, --sysroot=SYSROOT prepend SYSROOT to all paths for scanning -v, --verbose display status information while busy -V, --version display font config version and exit -h, --help display this help and exit
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?