87
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

新卒が現場で使ったLinuxコマンド備忘録

Last updated at Posted at 2025-12-22

はじめに

今年の6月から初めての現場配属をされ、CUIに触れる機会が多くなりました。この記事では、実務で使用したLinuxコマンドを、現場の状況とあわせて紹介します。

接続系コマンド

ssh xx.xx.xx.xx
telnet xx.xx.xx.xx

サーバにリモート接続するためのもの。
SSHは暗号化がされているためこちらが優先されているが、一部の古いサーバではtelnetを使用した。

ディレクトリ操作

pwd - 現在のディレクトリの表示
cd - ディレクトリ移動
ll - 詳細情報付きで一覧表示
mkdir - 新しディレクトリ作成
rm - ファイルやディレクトリなどの削除

作業するディレクトリの移動の時に使うもの。頻繁に使用している基本操作。

ファイル操作

vi/view - ファイルの編集/閲覧
cat - ファイルの中身を確認
tail - 最終行から数行を表示する
cp - ファイルのコピー
diff - ファイル間の差分の確認
//vi使用時のコマンド
:set number - 行番号の表示
/hogefuga - 単語検索
:e ++enc=utf-8 - UTF-8指定で開く

ファイルを編集するときのもの。バックアップを取るためにコピーを取ったり、ファイルを編集した際の履歴を取るために差分を取ったりした。

検索・集計系

grep - テキストの検索
grep -c - ヒットした件数
grep -v - 除外検索

find - ファイル検索
xargs - 標準入力から引数を渡す

データの集計やフィルタをかけるときのもの。
オプションを使うことで集計を効率よくすることができる。

また、それぞれを組み合わせることで、さらに効率化なデータの抽出ができる。

//特定のプロセスを探す
ps -eaf | grep xxxx

//ヒット件数が0のファイルを除外
grep -c "name" hogefuga* | grep -v "0"

//ファイルごとの出現回数を表示
find . -name hogefuga* | xargs grep -c "xxxxxx"

おわりに

コマンド自体はシンプルでしたが、状況に応じてどれをどのように使用するかを考えて使うことには慣れが必要でした。
今後も、扱ったことがないものや、コマンドを組み合わせて効率よく作業ができるものを学び、知識をアップデートしていきたいです。

以上、ありがとうございました。

87
20
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
87
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?