Linux terminal

 This is linux command Note:

 

I trying to speak fluent english. So mistake can be done.

Basic things that I need to know.

 Know: Who is the first company with came of GUI ?

Xerox . Xerox is the first company came with GUI.

Stev jobs was the second  person who reproduce GUI with Macintosh.

GUI---> Graphical User Interface.

CLI---> Command Line Interface.

I am a CLI user. I terminal is my life to live.

GUI is slower than CLI.

CLI is always faster.

 

Windows use GUI

linux use CLI.

 

Gitbash is a CLI.

Gitbash use in windows OS to work with command line.

 

Now everything about CLI.

1. How to create a new directory?
Directory
's another name is Folder.

$ mkdir space directoryName

mkdir ----> make directory

mkdir is a command for creating new directory or folder.

Remember: It is better practice to keep everything lowercase in CLI for coder.


2. what is path ?

A path is a string of characters used to uniquely identify a location in a directory structure. 

 Let's see my path, Go to terminal and type 'pwd'

 

PWD---> Present Working Directory or Print Working Directory.

It will show like below...

$ /desktop/music/myMusic/

 

3.

Root Direcory:The start of each and every directory in linux system.

/------> This is forward slash. This slash mean root directory in Linux OS.

 

 How to see current Directory
Go to terminal and type below cmd.

$  pwd 

cmd -----> Command.


 4. Command for changing the Directory ?
$ cd
space directoryName

cd ---> Change Directory


5. How to see all the content inside a Directory?
$ ls

ls -----> List Content. (It will list all the files and folder from current directory.)

 

6. How to go one step back from current directory ?
$ cd space ..

It will move you one step back from current directory.

Remember: How to go two step back from current directory?
$ cd space ../../

 * Three step back.
$ cd space ../../..

 

 Shortcut:

mkdir ---> create a new directory
cd ------> changing directory
ls -------> Listing all the contents
cd space ..  -----> Going one step back
pwd-------> Present Working Directory.


7. How to create a hidden directory or file
$ mkdir . directoryName

mkdir space dot directoryOrFileName

 Remember:  How to see Hidden folder or files?
$ ls space -a

ls space hiphen a (-a)

ls -a -------------->  This command list all files and folders or directories including hidden.

ls --------> ls command can not list hidden files and directories.



8. How to create multiple folder or directory using single line command?

 $ mkdir directoryName1 space directoryName2 space directoryName3 space directoryName4

This above command will create 4 Directories.


Remember: How  to create a directory with space
$ mkdir space "Directory space Name"

If you want to create a directory with space then you need to put single/double Quotes like above cmd.



9. How to go to one drive to another drive using command ?
$ cd space D:/desktop/files/

This above cmd will go into D drive desktop files.

Now how to go C drive:      
$ cd space C:\                <----enter


10. How to go root directory ?
$ cd space /
or
$ cd space forward slash.


11. How to go another directory Directly
$ cd ../ directoryName

$ cd space ../ directoryName


12. How to move Directory or files?
$ mv space directory1 space directory2

or

$ mv space ./file1 space ./file2 

mv -------> move

This mv cmd will move directory1 into directory2.

"directory1" is a source file and 

"directory2" is a Destination file.

 


13. How to rename a file or Directory ?
$ mv space ./file1 space ./myFile /file2

file1 is source file.
myFile is a destination file.
file2 is a new name of directory file1

We rename file1 directory to file2.

 

 14. How to see recent command that you used?
$ !!

!! -----> Two exclamation mark.

 

15. How to copy directory or a file ?
$ cp space -r space ./file1 space ./file2

cp------> Copy



16. How to move or copy a file to the previous Directory ?
$ mv space ./fileName space ../

 

17. How to delete a file or directory ?
$ rm space fileName

rm stands for remove.


Remember: How to delete a hidden directory or file ?
$ rm space -r . /. fileName

-r mean recursively


18. How to delete a directory that created with space ?
$ rm space ./"file Name"


19. How to create a text file?
$ touch space fileName.txt


Remember: How to create a JPG file?
$ touch fileName.jpg

 

 

20. How to copy multiple files to another directory?
$ cp space -r ./file1 space ./file2 space ./file3 space ./"NewFile"

NB: file1 and file2 and file3 is a source file name.
NewFile is directory name and destination file.



21. How to move multiple directory?
$ mv space ./file1 space ./file2 space ./destinationFile

 

22. How to rename a directory without  moving anywhere ?
$ mv space . /fileName space . /fileNameX

fileName rename to fileNameX



23. How to create a txt file and write text into the file ?
$ echo space
how are you this is text. >>myFile.txt


24. How to see/read  text inside a txt file ?
$ cat space txt. space filename.

 

25. How to write text inside a JPG file ?
$ echo This is my secret text inside jpg file space >file.jpg

 

Remember: How to read jpg file text
$ cat space file.jpg    ----------------------------> This will show text inside the jpg file.



26. How to copy two files and paste two step back Directory.
$ cp space ./abc.txt space ./xyz space ../../


Remember:
how to go previous directory
$ cd -

How to go root directory.
$ cd / 

How to go one step back from current path ?
$ cd - -

 How to go home directory?
$ cd ~

( cd space Back track special character.)


touch: This command create empty file with what ever extension we want like jpg/pdf/txt etc.

echo: This command create files like txt/jpg/pdf with text and that command is echo.










 

 


إرسال تعليق (0)
أحدث أقدم