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 |