How to Manage Your Alibaba Cloud Linux Server from the Command Line Interface (CLI)

Prerequisites

1: Linux whoami Command

$ whoami
james

2: Linux pwd Command

$ pwd
/home/james

3: Linux cd Command

$ cd test
$ james@server1:~/test$
$ cd ..
$ james@server1:~$
$ cd /
james@server1:/$

4: Linux ls Command

$ ls
$mail  test
$ ls –l
drwx------ 3 james james 4096 Jul  1 11:49 mail
drwxrwxr-x 2 james james 4096 Jul 16 08:23 test

5: Linux mkdir Command

$ mkdir demo
$ ls –l
drwxrwxr-x 2 james james 4096 Jul 16 09:07 demo
drwx------ 3 james james 4096 Jul 1 11:49 mail
drwxrwxr-x 2 james james 4096 Jul 16 08:23 test

6: Linux touch Command

$ touch text1.txt
$ ls -l
drwxrwxr-x 2 james james 4096 Jul 16 09:07 demo
drwx------ 3 james james 4096 Jul 1 11:49 mail
drwxrwxr-x 2 james james 4096 Jul 16 08:23 test
-rw-rw-r-- 1 james james 0 Jul 16 09:08 text1.txt

7: Linux rmdir Command

$ rmdir demo

8: Linux rm Command

$ rm text1.txt
$ rm -r
$ rm -r demo

9: Linux cp Command

$ cp
$ touch demo1.txt
$ cp demo1.txt demo2.txt
$ ls –l
...
-rw-rw-r-- 1 james james 0 Jul 16 09:10 demo1.txt
-rw-rw-r-- 1 james james 0 Jul 16 09:11 demo2.txt
...
$ mkdir demos
$ cp *.txt demos/
$ cd demos
$ ls -l
-rw-rw-r-- 1 james james 0 Jul 16 09:13 demo1.txt
-rw-rw-r-- 1 james james 0 Jul 16 09:13 demo2.txt
$ cd ..

10: Linux mv Command

$ mv
$ mv demo3.txt demo4.txt

11: Linux man command

$ man mv
MV(1)                                                 User Commands                                                 MV(1)
NAME
mv - move (rename) files
SYNOPSIS
mv [OPTION]... [-T] SOURCE DEST
mv [OPTION]... SOURCE... DIRECTORY
mv [OPTION]... -t DIRECTORY SOURCE...
DESCRIPTION
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
Mandatory arguments to long options are mandatory for short options too.

12: Linux echo Command

$ echo sample text
sample text
$ echo sample text > text1.txt
$ echo additional sample text >> text1.txt
$ echo *

13: Linux cat Command

$ cat text1.txt
sample text
additional sample text
$ cat text1.txt text2.txt

14: Linux more Command

$ more text1.txt
sample text
additional sample text

15: Linux grep Command

$ grep 'keyword'
$ grep sample text1.txt
sample text
additional sample text

16: Linux history Command

$ history
1    ls -a
2 rm *.txt
3 rm -r demos
4 rm test
5 ls -a
6 ls
7 ls -p
...
$ !
$ !5

17: Linux chown Command

$ chown .
$ mkdir demo10
$ sudo chown joseph.joseph demo10
...
drwxrwxr-x 2 joseph joseph 4096 Jul 16 10:08 demo10
...

18: Linux chmod Command

$ chmod options
$ chmod 777 demo10

19: Linux free Command

$ free –h
total        used        free      shared  buff/cache   available
Mem: 985M 302M 72M 2.3M 610M 496M
Swap: 0B 0B 0B

20: Linux df Command

$ df –f
Filesystem      Size  Used Avail Use% Mounted on
udev 464M 0 464M 0% /dev
tmpfs 99M 640K 98M 1% /run
/dev/vda1 25G 3.4G 20G 15% /
tmpfs 493M 0 493M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 493M 0 493M 0% /sys/fs/cgroup
tmpfs 99M 0 99M 0% /run/user/1000

21: Linux date Command

$ date
Mon Jul 16 10:26:39 EAT 2018
$ date --set="YYYYMMDD HH:MM"
$ sudo date --set="20180716 10:30"

22: Linux sudo Command

23: Linux reboot Command

$ sudo reboot

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store