Command |
Description |
Example |
Basic commands |
|
|
Date |
Show Time and date |
|
Echo |
Print out text on the screen |
|
Grep |
is a Find command |
grep AA Test.txt |
History |
Give the commands you or other users have entered earlier |
History-3 show the last three commands |
Password |
Change Password |
|
Uname |
Machine Name and machine information |
|
Whereis |
Ask where the executable file of the application is located |
Whereis who |
which |
Help check if the version of the command is used correctly |
|
W.H.O. |
List all online users |
|
WhoAmI |
Who is the current user |
|
Env |
Show all environment variables |
|
Mans |
Help commands |
Man Date |
Directory Management |
|
|
Cd |
Switch directories |
|
Ls |
List Directory |
|
Pwd |
Show current directory |
|
Mkdir |
New Catalog |
|
RmDir |
Delete Directory |
|
Important Linux Directories |
|
|
/etc |
directory where system configuration files are saved |
|
/dev |
Device information file |
|
/tmp |
Temporary files, logs, etc. |
|
Home |
When you create a user, you automatically assign the directory, and you have all the permissions for this directory |
|
Root |
All system administrators, at the top of the tree |
|
Read the text |
|
|
More |
command display, press the screen, press ENTER to display the next screen |
For larger text |
Cat |
Show all contents of current text |
Small text |
Head |
The first 10 rows are displayed by default |
Head-5/etc/group.txt |
Tail |
Display the following 10 rows by default |
Tail-5/etc/group.txt |
Managing Files |
|
|
Diff |
Compare Text |
Diff T1.txt T2.txt |
Touch |
Create an empty file |
Touch test.sh |
Mv |
Move the file, or change the file name |
MV A.txt B.txt |
Cp |
Copy files |
Cp A.txt/home |
Rm |
deleting files |
|
chmod |
Change file permissions |
CHMOD–G–RW Test.txt |
Chgrp |
Change the group to which a file belongs |
CHGRP groupname filename |
Umask |
Default file and directory permissions on the current server |
It is an environment variable |
Edit Text |
|
|
Vi |
Edit Document |
|
Cursor navigation |
|
|
H |
Move one character to the left |
|
L |
Move one character to the right |
|
J |
Move down one line |
|
K |
Move up one line |
|
W |
To the beginning of the next word |
|
B |
To the beginning of a previous word |
|
$ |
To the end of the current line |
|
^ |
To the beginning of the current line |
|
: G |
To the end of the file |
|
: l |
to the file header |
|
Gg |
Move cursor to First line |
|
G |
Cursor moves to tail line |
|
NG |
Move cursor to nth row |
|
Processing commands |
|
|
I |
Insert starting from current character |
|
A |
Start inserting from the next character |
|
O |
Insert from a new line below |
|
O |
Start inserting from a new line on top |
|
X |
Delete the character at the cursor location |
|
Dd |
Delete the downward line where the cursor is located |
|
Ndd |
Delete the next n rows where the cursor is located |
|
R |
Replace the character at which the cursor is located |
|
(n) yy |
Copy the (n) row where you are visiting |
|
P |
Pastes the copied rows after the current cursor |
|
P (uppercase) |
Paste the copied line on the current cursor |
|
: Q |
Exit and discard Changes |
|
: wq! |
Save and exit |
|