The basic commands commonly used in linux!

Data: current date

Red Hat Linux release 9 (Shrike)

Kernel 2.4.20-8 on an i686

login: user1

[user1@linux user1]$ date

Thu Apr 26 11:22:16CST 2018

[user1@linux user1]$

Cal: View April 2018

 [user1@linux user1]$ cal 4 2018

     April 2018

day one two three four five six

 1 2  3  4 5  6  7

 8  9 1011 12 13 14

15 16 17 18 19 20 21

22 23 24 25 26 27 28

29 30

[user1@linux user1]$

 Passwd: change password

 [user1@linux user1]$ passwd

Changing password for user user1.

New password:

BAD PASSWORD: it is too short

New password:

Retype new password:

passwd: all authentication tokens updatedsuccessfully.

mkdir ls creates a specified directory and sees

[user1@linux user1]$ mkdir -p./home/mengqc/fil3

[user1@linux user1]$ ls

fil1 fil2  fil3  home

cat: create a file and enter

[user1@linux user1]$ cat >fil1

aaaasdasd

sdasdad

aaaaaaa

aaaaaaa

[user1@linux user1]$

more

[user1@linux user1]$ more fil1

aaaasdasd

sdasdad

aaaaaaa

aaaaaaa

[user1@linux user1]$ y

grep: indicates the line where aa is in the output of fil1

[user1@linuxuser1]$ grep aa fil1

aaaaaaaaaaaaaa

aaaaaaaaaaaaaa

[user1 @ linuxuser1] $

Comn: Compare fil fil2

[user1@linux user1]$ comm fil1 fil2

                aaaaaaaaaaaaaa

       aaaaaaaaaaaaaa

aaaaaaaaaaaaabbbbbbbbbbbbb

bbbbbbbbbbbbb

bbbbbbbbbbbb

bbbbbbbbbb

[user1@linux user1]$

diff: (1): Compare two files and find their differences

[user1@linux user1]$ diff -c fil3 fil4

*** fil3 2018-05-02 10:39:29.000000000 +0800

--- fil4 2018-05-02 10:40:07,000000000 +0800

***************

*** 1,2 ****

  aaa

wo shi zhong guo ren !

--- 1,2 ----

  aaa

! wo shi mei guo ren!

[user1@linux user1]$

2

[user1@linux user1]$ diff -i fil2 fil4

1,2c1,2

< aaaaaaaaaaaaa

< aaaaaaaaaaaaa

\ No newline at end of file

---

> aaa

> wo shi mei guo ren!

[user1@linux user1]$

rm command to delete files and directories

> wo shi mei guo ren!

[user1@linux user1]$ rm -i fil1 fil2

rm: delete general file 'fil1'? y

rm: delete general file 'fil2'? y

[user1@linux user1]$

mv: command to rename a file or directory

 [user1@linux user1]$ mv fil3 fil5

[user1@linux user1]$ ls

aa fil4  fil5

wc: command to specify the number of bytes, words, and lines of the file and display the statistical results

[user1@linux user1]$ wc -cw fil4 fil5

     6 24 files4

     7      27 fil5

    13 51 Total usage

[user1@linux user1]$ who|wc -l

     1

[user1@linux user1]$ who|wc fil4

     2 6 24 files4

cd pwd change the current path

[user1@linux home]$ pwd user1

/home

[user1@linux home]$ cd user1

[user1@linux user1]$

In is used to create links

[user1@linux fil3]$ ln fil4 fil3

[user1@linux fil3]$ ls -all

Total dosage 16

drwxrwxr-x    2 user1   user1        4096  5月  2 17:53 .

drwxrwxr-x    3 user1   user1        4096  5月  2 17:48 ..

-rw-rw-r--    2 user1   user1          49  5月  2 17:53 fil3

-rw-rw-r--    2 user1   user1          49  5月  2 17:53 fil4

[user1 @ linux fil3] $ ls -l

Total usage 8

-rw-rw-r--    2 user1   user1          49  5月  2 17:53 fil3

-rw-rw-r--    2 user1   user1          49  5月  2 17:53 fil4

Chmod: used to change or set the access permissions of a file or directory

[user1@linux user1]$ chmod o+w aa

[user1@linux user1]$ ls -l aa

-rw-rw-rw-    1 user1   user1           0  5月  2 10:10 aa

Umask: The command is used to set the mask that restricts the permissions of new files

[user1@linux user1]$ umask 0022

[user1@linux user1]$ umask -S

u = rwx, g = rx, o = rx

[user1@linux user1]$ cat > fil6

666666

 [user1@linux user1]$ ls -l

Total dosage 20

-rw-rw-r--    1 user1   user1          16  5月  2 17:42 fil1

-rw-rw-r--    1 user1   user1          15  5月  2 17:43 fil2

-rw-rw-r--    1 user1   user1          12  5月  2 17:43 fil3

-rw-r--r--    1 user1   user1           7  5月  2 18:06 fil6

drwxrwxr-x    3 user1   user1        4096  5月  2 17:48 home

groups: View the group you belong to

[user1@linux user1]$ groups user1

user1 : user1

chgrp chown: command privileges that only superusers can have

[user1@linux user1]$ su – root

 [root@linux root]# ls /home/user1

fil1 fil2  fil3  fil6 home

[root@linux root]# chgrp user2/home/user1/fil1

[root@linux root]# chown user2/home/user1/fil1

[root@linux root]# ls -l /home/user1/fil1

-rw-rw-r--    1 user2   user2          16  5月  2 17:42 /home/user1/fil1

[root@linux root]#

man

[root@linux root]# man -w

/usr/share/man:/usr/local/share/man:/usr/X11R6/man

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325190716&siteId=291194637