Using the CLI makes it easier to follow and give advice. While I am not advocating feeding your system with commands you do not understand, it is easier to copy and paste a command than clicking around in a GUI that is changing from version to another.
Although new commands are introduced from time to time, the original commands almost always remain the same.
Arch
The arch command is used to print the machine's architecture. For example:
Code: Select all
$ arch
x86_64
Cal/ncal
The cal and ncal commands will display a calendar:
Code: Select all
$ cal
Februar 2019
su må ty on to fr la
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28
The cat command prints the information of a file.
Code: Select all
$ cat debian.txt
Debian is awesome
The cd command - change directory – allows you to navigate to a given directory.
Code: Select all
$ cd /home/hallvor/Music
The chgrp command changes the group ownership of a file. Use group name as first argument and the name of the file as second argument.
Code: Select all
$ chgrp debian debian.txt
The chmod command changes access permissions for a file, for instance making it executable:
Code: Select all
$ chmod +x debian.bin
The chown command changes ownership and group of a file. This example changes ownership and group to root:
Code: Select all
# chown root:root debian.txt
The clear command clears the terminal screen.
Code: Select all
$ clear
The cp command copies files and directories. This command will copy debian.txt to my documents folder in my home directory:
Code: Select all
$ cp debian.txt /home/hallvor/Documents
The date command can print or set the system date and time.
Code: Select all
$ date
må. 18. feb. 18:58:56 +0100 2019
Df
The df command displays the file system disk space usage in output.
Code: Select all
$ df
Filsystem 1K-blokker Brukt Tilgjengelig Bruk% Montert på
udev 3918824 0 3918824 0% /dev
tmpfs 786256 17624 768632 3% /run
/dev/mapper/debian--thinkpad--vg-root 236889936 44816920 179969952 20% /
tmpfs 3931260 33948 3897312 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 3931260 0 3931260 0% /sys/fs/cgroup
/dev/sda1 240972 38829 189702 17% /boot
tmpfs 786252 0 786252 0% /run/user/113
tmpfs 786252 28 786224 1% /run/user/1000
Dir
The dir command lists directory contents.
Code: Select all
$ dir
Movies Documents debian.txt
The dpkg tool is a CLI package manager for Debian. To install a downloaded deb-file:
Code: Select all
# dpkg -i filename.deb
The exit command will exit the shell
Code: Select all
$ exit
Find
The find command will search for files in a directory and in its sub-directories.
Code: Select all
$ find debian*
debian
debian2
debian.txt
The free command displays the amount of free and used memory in the system.
Code: Select all
$ free
total used free shared buff/cache available
Mem: 7862524 1513612 708188 258528 5640724 5816176
Swap: 8069116 0 8069116
The grep command searches for a specified content in a file (or files) and displays the content:
Code: Select all
$ grep "Debian" debian.txt
Debian rocks!
Groups displays the name of groups a user is part of.
Code: Select all
$ groups hallvor
hallvor : hallvor cdrom floppy audio dip video plugdev netdev bluetooth lpadmin
History
The history command displays the history of your shell commands.
Code: Select all
$ history
The kill command kills a process by sending the TERM signal to it.
Code: Select all
# kill [process-id]
Killall
The killall command kills a process by name.
Code: Select all
# killall konsole
The locate command helps user find a file by name. In Debian you may have to do the following to make the command work:
Code: Select all
# apt install locate && updatedb
Code: Select all
$ locate *.txt
/home/hallvor/debian.txt
/home/hallvor/test/debian.txt
The ls command shows all non-hidden files, folders and directories.
Code: Select all
$ ls
The lscpu command displays the CPU architecture information:
Code: Select all
$ lscpu
Arkitektur: x86_64
Op-tilstande for CPU: 32-bit, 64-bit
Byterækkefølge: Little Endian
CPU'er: 4
Tilkoblet cpu(er) liste:0-3
Tråde per kerne: 2
Kerner per sokkel: 2
Sokler: 1
NUMA-knuder: 1
Leverandør-id: GenuineIntel
CPU-familie: 6
Model: 69
Modelnavn: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
Modelserie: 1
CPU MHz: 1204.980
CPU maks. MHz: 3300,0000
CPU min. MHz: 800,0000
BogoMIPS: 5387.59
Virtualisation: VT-x
L1d mellemlager: 32K
L1i mellemlager: 32K
L2 mellemlager: 256K
L3 mellemlager: 4096K
NUMA-knuder0 CPU'er: 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dte
s64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single ssbd ibrs ibpb stibp kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1
avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts flush_l1d
Lspci
Prints detailed information about all PCI buses and devices in the system.
Code: Select all
$ lspci
Lsusb
Displays information about USB buses in the system and the devices connected to them.
Code: Select all
$ lsusb
man lets you access the manual pages. For instance:
Code: Select all
$ man grep
The mkdir command lets you create directories.
Code: Select all
$ mkdir test
The mv command (move) allows you to move a file or folder from the old location to the new location. (It can also be used to rename a file):
Code: Select all
$ mv /home/hallvor/debian.txt /home/hallvor/Dokument/debian.txt
The passwd command changes passwords
Code: Select all
$ passwd hallvor
Code: Select all
# passwd root
Ping
The ping command is used to check if a system is up and responding.
Code: Select all
$ ping -c3 google.com
PING google.com (216.58.211.14) 56(84) bytes of data.
64 bytes from arn09s20-in-f14.1e100.net (216.58.211.14): icmp_seq=1 ttl=53 time=33.5 ms
64 bytes from arn09s20-in-f14.1e100.net (216.58.211.14): icmp_seq=2 ttl=53 time=34.1 ms
64 bytes from arn09s20-in-f14.1e100.net (216.58.211.14): icmp_seq=3 ttl=53 time=36.0 ms
rmdir
The rmdir (remove directory) command allows the user to remove an existing directory. For instance:
Code: Select all
$ rmdir test
Code: Select all
$ rmdir --ignore-fail-on-non-empty test
rm
The rm command (remove) will remove/delete files or directories with files in it. For instance:
Code: Select all
$ rm debian.txt
Code: Select all
$ rm -r /home/hallvor/dokument
Su
The su (switch user) command lets you change user identity. The most common usage is to become root:
Code: Select all
$ su -
Code: Select all
# su - hallvor
The top command lists running processes
Code: Select all
$ top
The touch command makes an empty file
Code: Select all
$ touch debian.txt