Linux command cheat sheet

Command line editing operations

Cursor operation

command Execution result
Ctrl + b Move one character toward the beginning
Ctrl + f Move one character toward the end
Ctrl + a Move to the beginning of the command
Ctrl + e Move to the end of the command
Esc + b Move to the beginning for one word
Esc + f Move toward the end of one word

Delete characters

command Execution result
Ctrl + h Delete one character
Ctrl + w Delete up to the next space in the leading direction
Ctrl + k Cut from cursor to end
Ctrl + u Cut from the cursor to the beginning
Ctrl + y Paste the cut command

Command completion

command Execution result
tab Completing the command from the entered character string
tab > tab List display of multiple candidates

Use command history

command Execution result
Ctrl +p or ↑ Display the previously entered command
Ctrl +n or ↓ Display the command entered after one
Ctrl + r Search command history

Directory manipulation

command Execution result
pwd Show full path of current directory
cd Change current directory
mkdir Create a new directory
rm -rf Forced deletion of directories
rm -i Delete the directory with confirmation if you really want to delete it.
rmdir Delete empty directory
cp -r Copy directory

ls command

List files in the current directory

option Execution result
-l Additional display of detailed information
-a Show including hidden files
-F List display including file types
-w 30 The file name is displayed in the width of the specified number. Width here=30 digits

File operations

command Execution result
touch Create a new file
rm Delete file
cp File copy (forced overwrite)
mv Move files, rename files
ln -s Creating a symbolic link (alias)

Browse files

command Execution result
cat Display the contents of the specified file. If you specify more than one, the contents are connected and displayed.
less View files screen by screen and scroll up and down

less command

Operation while the screen is displayed

command Execution result
Space bar Scroll down one screen
b Scroll up one screen
q Close screen
/ Search downwards
n Move to the next search result
N Go to previous search results

Search

command Execution result
find -name Search file names in a case-sensitive manner
find -iname Search file names in a case-insensitive manner
which Show command path

Process and job operations

command Execution result
ps View process
ps x Show including processes running in another terminal or daemon
Ctrl + Z Suspend current job
jobs List current jobs
fg %1 Resume the first job
bg %1 Resume the first job in the background
At the end of the command line& Run command in background
kill %1 Finish the first job
kill process ID End process

filter

command Execution result
cat Output the input as it is
head Show first 10 lines
tail Show last 10 lines
grep Show only lines that match the specified search pattern
sort Sorting
uniq Remove duplicate lines
tac Output in reverse order
wc Display the number of lines, words, and bytes
tr Character replacement

Recommended Posts

Linux command cheat sheet
conda command cheat sheet
ps command cheat sheet
Linux command # 4
Linux command # 3
Linux command # 5
linux at command
[Linux] Search command
Linux command <Basic 2>
Linux [directory command]
Linux server command
Linux # Command Memo 1
Linux command [read]
Linux Command Summary
[Basic] linux command
Linux [shell command]
[Linux] Command / Knowledge
Curry cheat sheet
My linux command
Linux command <Basic 1>
Linux command collection
Linux mkdir command
SQLite3 cheat sheet
pyenv cheat sheet
Linux command basics
[Linux] Git command
Linux (command memory)
[Linux] Volume configuration command
Linux command (sequential update)
Linux basic command memorandum
Spark API cheat sheet
Python3 cheat sheet (basic)
Linux command [File operation]
PySpark Cheat Sheet [Python]
Python sort cheat sheet
[Linux] Basic command summary
Go language cheat sheet
Linux command for self-collection
linux command error collection 1
Linux command line shortcut
tox configuration file cheat sheet
linux sar command CPU usage
[Linux] tar.gz compression / decompression command
numpy memory reuse cheat sheet
What is Linux? [Command list]
[Python3] Standard input [Cheat sheet]
Data Science Cheat Sheet (Python)
Slack API attachments cheat sheet
Easy df command on Linux
Linux tar xz command memo
Python Django Tutorial Cheat Sheet
Linux Command Dictionary (for myself)
linux: create original Terminal command
[Note] Useful linux command collection
Linux command memorandum [for beginners]
Linux PC spec check command
scikit learn algorithm cheat sheet
[Linux] User / group command summary
Apache Beam Cheat Sheet [Python]
Google Test / Mock personal cheat sheet
[Linux convenient command] Try inserting exa