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

Prerequisites

  • A valid Alibaba Cloud account. If you don’t have one, try Alibaba Cloud today and get $300 worth in Free Trial.
  • An ECS instance running any Linux distribution (e.g. Ubuntu, Centos, Debian)
  • An SSH username and password for the ECS instance.
  • For the sake of simplicity we will be using a hypothetical user ‘james’.

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

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

🌟MINI GAME FOR GLOBAL ZOMBIE WORLD Z COMMUNITY — “WEEKLY QUIZ”🌟

PouchContainer RingBuffer Log Practices

Docker Container-Centric Commands for Beginners: Part 2

Start Creating Module Using Drupal Console

Module creation using drupal console CLI

Monthly Dev Update — February 2021

How Kubernetes SIG-Cloud-Provider-Alibaba Works

Move-To-Earn With STEPN

Those fancy words used by functional programmers purists really annoy me.

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
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

GitLab CD Pipeline for Linux package management

Creating a Lightweight Local Windows K8S & Docker Development Environment

Running a Linux-based NFS Server in Docker on Windows

Learn Docker:Network access (6/6)