Basic Linux Commands



  • ls - list files and directories in the current working directory.

omar@omar-pc:~$ ls

code? Desktop? Documents? Downloads? Music? Pictures? Public? snap? Templates? Videos        

  • pwd - print the current working directory or path


omar@omar-pc:~$ pwd

/home/omar        

  • cd - navigate through directories


omar@omar-pc:~$ cd Downloads

omar@omar-pc:~/Downloads$?        



  • mkdir - create directories?


omar@omar-pc:~/MyFolder$ mkdir NewFolder

omar@omar-pc:~/MyFolder$ ls

NewFolder

omar@omar-pc:~/MyFolder$ mkdir Code

omar@omar-pc:~/MyFolder$ ls

Code? NewFolder

        



  • mv - move or rename files or directories

# rename


omar@omar-pc:~/MyFolder$ ls

Code? OldFolder

omar@omar-pc:~/MyFolder$ mv OldFolder NewFolder

omar@omar-pc:~/MyFolder$ ls

Code? NewFolder

        

# move


omar@omar-pc:~/MyFolder$ ls
Code? NewFolder

omar@omar-pc:~/MyFolder$ mv Code NewFolder/Code

omar@omar-pc:~/MyFolder$ ls
NewFolder

omar@omar-pc:~/MyFolder$ cd NewFolder/

omar@omar-pc:~/MyFolder/NewFolder$ ls
Code

        

  • touch - Create blank/empty file


omar@omar-pc:~/MyFolder/NewFolder$ touch source_file.txt
omar@omar-pc:~/MyFolder/NewFolder$ touch target_file.txt        

  • cp?- copying files


cp source_file.txt target_file.txt        



  • rm - remove files or directories


omar@omar-pc:~/MyFolder/NewFolder$ rm source_file.txt?         



  • rm -rf - remove files or directories


omar@omar-pc:~/MyFolder/NewFolder$ rm -rf Code        

  • cat - display file contents on the terminal


omar@omar-pc:~/MyFolder/NewFolder$ cat target_file.txt
new line to copy?        

  • clear?- Clear the terminal display


omar@omar-pc:~/MyFolder/NewFolder$ clear?        

  • wget?- Direct download files from the internet


omar@omar-pc:~ wget https://media.readthedocs.org/pdf/django/3.2.x/django.pdf
        

  • man - Access manual (documentation) pages?of applications.


omar@omar-pc:~ man docker        

  • head - show the first 10 lines from the file in terminal


omar@omar-pc:~$ head my_text.txt?

1
2
3
4
5
6
7
8
9
10


        



  • tail - show the last 10 lines from the file in terminal



omar@omar-pc:~$ tail my_text.txt
22
23
24
25
26
27
28
29
30
?        



  • alias -



omar@omar-pc:~$ alias all_containers="docker ps -a"

omar@omar-pc:~$ all_containers?

CONTAINER ID? ?IMAGE? ? ? ? ? ? ? ? ? ? ? ? ? COMMAND? ? ? ? ? ? ? ? ?         

要查看或添加评论,请登录

Omar Faruk的更多文章

社区洞察

其他会员也浏览了