Ls
List directory contents.
Ex:
$ ls /applications
Will display all files and folders stored in the application folder.
CD
Change directory
Ex:
$ cd /etc
MV
Rename or move files or directories
Ex:
$ mv example.md /home/qlarson/Documents/
Creates a copy of "example.md" in the "Documents" directory.
Alias
Creates a pseudonym for Linux command, that is, it changes the name of a command
Ex:
$ alias seach=grep
Will allow the use of grep instead of seach.
Cat
Displays the contents of a file on the screen
Ex:
$ cat do.md
Will show the text of "do.md" on the screen
Chown
Change the owner of a file Ex:
$ chown qlarson do.md
Now "qlarson" will be the owner of "do.md".
Chmod
Changes a file's permissions.
Ex:
$ chmon 777 do.md
It will make "do.md" readable, writable and executable by everyone. The digits in "777" specify the permissions for the user, group and others, in that order.
Sudo
Perform tasks that require administrative or root permissions.
Ex:
$ sudo passwd quincy
Change the user's password to "quincy".
Find
Searches for files that match a given pattern. This command is to search for file(s) and folder(s) using filters such as name, size, access time and modification time.
Ex:
$ find / home / -name do.md
It will look for a file called "do.md" in the home directory and its subdirectories
Grep
Search files or output for a specific string or expression. This command looks for lines containing a specified pattern and, by default, writes them to standard output.
Ex:
$ grep run do.md
It will look for the word 'run' in the 'do.md' file. Lines containing "execute" will be displayed.
Date
Shows the time and date.
Ex:
$ date
=>Wed 27 May 2020 17:19:50 -03
Df
View a report on system disk space usage.
Ex:
$ df
Sist. Arq. Tam. Usado Disp. Uso% Montado em
dev 3,7G 0 3,7G 0% /dev
run 3,7G 1,5M 3,7G 1% /run
/dev/sda1 908G 48G 814G 6% /
Du
Shows how much space each file occupies. This will show size in the disk block numbers. If you want to see them in bytes, kilobytes, megabytes, add the '-h'.
Ex:
$ du -h
20K ./public
4,0K ./tmp/cache/assets
8,0K ./tmp/cache
12K ./tmp
4,0K ./test/helpers
4,0K ./test/integration
File
Determines the type of a file.
Ex:
$ file do.md
History
Shows the command history.
Ex:
$ history
348 cd testGit
349 git init
350 git status
351 npm init -y
352 git status
*Kill
Stop a process
Ex:
$ kill 485
Less
View the contents of a file, one page at a time.
Ex:
$ lessdo.md
Ps
Displays a list of the processes currently running. This can be used to determine the PIDs needed for "kill" processes.
Ex:
$ ps
PID TTY TIME CMD
79495 pts/3 00:00:00 bash
79985 pts/3 00:00:00 ps
PWD
Displays the path name for the current directory. "Print Working Directory".
Ex:
$ pwd
/home/quemia/Documents
SSH
Log in remotely to another linux machine, over the network.
Ex:
$ ssh que@104.25.105.32
Log in to 104.25.105.32 using the username "que".
Tail
Displays the last 10 lines of a file, see more or less using the -n (number) option.0
Ex:
$ tail -n 5 do.md
Tar
Stores and extracts files from a tarfile (.tar) or tarball (.tar.gz or .tgz.).
Top
Displays the resources being used on your system, similar to the task manager in Windows.
Ex:
$ top
PID USUARIO PR NI VIRT RES SHR S %CPU %MEM TEMPO+ COMANDO
921 root 20 0 1851436 114224 63972 R 8,0 1,5 77:06.11 Xorg
6051 quemia 20 0 11,9g 250900 105484 S 5,6 3,3 2:21.36 code
1398 quemia 20 0 3778600 178044 118092 S 5,3 2,3 54:15.58 kwin_x11
6013 quemia 20 0 494032 131252 98440 S 5,3 1,7 0:36.24 code
33239 quemia 20 0 1155732 96712 78752 S 1,7 1,3 0:02.59 konsole
5988 quemia 20 0 982044 142092 98328 S 1,3 1,9 1:48.18 code
1402 quemia 20 0 3377736 356976 163732 S 1,0 4,7 8:58.93 plasmashell
327 root 20 0 8120 4812 1672 S 0,7 0,1 0:26.27 haveged