I will put here the main commands to know in a GNU/Linux environment when you start with it.
To know in which path you are, you can use the pwd command.
user01@host:~$ pwd /home/user01
Here, we can see that we are inside the user01 home directory.
Remember the Linux path structure (thanks to Wikipedia) and its Windows OS equivalence.
Directory | Description | Windows equivalence |
---|---|---|
/ | root directory of the entire file system hierarchy. | C:\ |
/bin, /sbin | command binaries. | C:\Program Files |
/boot | Boot loader files. | |
/dev | Device files. | Device Manager |
/etc | System configuration files. | Windows Registry |
/home | Users' home directories. | C:\Users |
/root | Home directory for the root user. | C:\Users\Administrator |
/tmp | Directory for temporary files. | C:\Windows\Temp |
/var | Variable files: files whose content is expected to continually change during normal operation of the system. |
Change working directory, we can use the cd (change directory) command.
user@host:~$ cd /tmp
To copy a file or a directory we can use cp.
user@host:~$ cp my_file my_file.bak
user@host:~$ cp my_file /tmp/
user@host:~$ cp my_file my_file.bak -t /tmp/
user@host:~$ cp -r my_directory my_directory.bak
user@host:~$ mkdir my_directory
To move a file or a directory we can use mv.
user@host:~$ mv my_file my_file.bak
user@host:~$ mv my_file /tmp/
user@host:~$ mv my_file my_file.bak -t /tmp/
user@host:~$ mv my_directory my_directory.bak
To list files we can use ls.
user@host:~$ ls my_directory my_directory.bak my_file my_file.bak
user@host:~$ ls -l total 8192 drwxr-xr-x 2 user user 40 25 oct. 12:12 my_directory drwxr-xr-x 2 user user 40 25 oct. 12:12 my_directory.bak -rw-r--r-- 1 user user 8388608 25 oct. 12:12 my_file -rw-r--r-- 1 user user 0 25 oct. 12:12 my_file.bak
You can see the d indicator for directories.
user@host:~$ ls -lh
total 8,0M
drwxr-xr-x 2 user user 40 25 oct. 12:12 my_directory
drwxr-xr-x 2 user user 40 25 oct. 12:12 my_directory.bak
-rw-r--r-- 1 user user 8,0M 25 oct. 13:22 my_file
-rw-r--r-- 1 user user 0 25 oct. 12:12 my_file.bak
To remove files or directories we can use the rm command.
user@host:~$ rm my_file
user@host:~$ rm -r my_directory
Particulary useful when you want to watch real time logs.
user@host:~$ tail -f /var/log/syslog
user@host:~$ find /home/user -iname '*std*' /home/user/std /home/user/anything_std_want /home/user/easy_std_way /home/user/easy_std /home/user/anemia_std
Contact :