arp – list the arp table (ARP – Address Resolution Protocol)
arp
or
arp -a

awk – Finds and Replaces text, database sort/validate/index
something
cat – To see the content of a file or concatenate files
cat /etc/fstab (to view a file)
cat > example.txt (to create the file example.txt)
All lines typed after this command will be saved into the file when typing CTRL+d
cat example.txt | more (to view the content of example.txt line by line after the first block has been displayed on the screen) (CTRL+c to quit) - Non scrollable with the mouse)
cat example.txt | less (same than | more ) CTRL+z to quit and scrollable with the mouse
cat example1.txt example2.txt > result.txt (to concatenate 2 files into another file)
cd – change directory
cd / : to go to the top directory
cd /var/www/ : to access to www directory, sub-directory of /var
cd (or cd ~): to go to Home directory
cd .. : to return to previous directory
cd ../../Test : to return to two previous directories, then to Test directory
chmod – change mode
chmod 775 *.php : will apply the mode 775 to all php files
chmod +x test.sh : will make the file test.sh executable
chown – change ownership
chown username /home/test : apply username ownership to directory /home/test
chown pi: /home/test : apply username 'pi' and group-name 'pi' ownership to directory /home/test. Equivalent to:
chown pi:pi /home/test
chown pi: -R /home/test : apply username 'pi' and group-name 'pi' ownership to directory /home/test and all its sub-directories
clear – to erase the content of the screen (can also be done with CTRL+L)
cmp – compares two files
cmp file1 file2 : will print the first byte and line different
cmp -s file1 file2 : will return an exit status indicating whether the files differ or not
cp – copy file
cp file1 file2
cp -R folder1 destination
To visualize the progress insert the option -v
cp -R -v folder1 destination
curl – transfer data to or from a server
to send /etc/password to a field 'password' in the page www.mypasswords.com:
curl -F password=@/etc/passwd www.mypasswords.com
to retrieve a web page and display in terminal (this allows to check that a website is accessible):
curl http://www.example.com
dd – data duplicator
sudo dd if=/dev/disk2 of=~/Desktop/clone.dmg : where the input file is /dev/disk2 and the output file is clone.dmg on the Desktop (Mac Os).
The following example, shows the progress status.
dd if=/dev/sda/ of=/dev/sdb/ bs=4M status=progress
To format an SD Card:
sudo dd if=/dev/zero of=/dev/sdc bs=4096 status=progress
(replace /dev/sdc by the actual target which can be identified by using lsblk command
df – disk free
df : will display all mounted partitions. Size is expressed in 1K-block
or
df -h : will display all mounted partitions. Size is expressed in Giga /Mega
dig – DNS Information Groper
[server] [name] [type]
[server] – The hostname or IP address the query is directed to
[name] – The DNS (Domain Name Server) of the server to query
[type] – The type of DNS record to retrieve. By default (or if left blank), dig uses the A record type
example:
dig assure.ameli.fr provides the following answer:

dmesg – driver message
dmesg : driver message (will list all the messages related to the drivers of the system)
du – disk usage
du -hd1 will list all folders and display the results in human (h) language with a depth (d) of 1 level
du /var/log -hd1 will list all folders in /var/log,.....
find – to search for a file or folder.
To find all files (database) with suffix .db (starting from the root directory)
sudo find / -type f -name "*.db"
To find a file but hide the errors detected by the ‘find’ command
find / -name somefile.txt 2>/dev/null
grep – to search a string
grep 'Linksys' /home/pi/*.* : will search for the string 'Linksys' in all the files contained in the directory /home/pi
grep -rl 'Linksys' /home/pi/*.* : will search for the string 'Linksys' in all the files contained in the directory /home/pi and all its sub-directories
head – takes the first line of a file
line=$(head -n 1 filename) : to read the first line of a file
line=$(head -n 5 filename) : to read the 5 first lines of a file
iw –
something
less – to view the content of a big file with the possibility of scrolling with the keyboard or the mouse. (See cat | less)
ls – list the content of a directory
ls -ll (or ls -l) : list directories/files with details
ls -la : list directories/files with details, including hidden directories/files
ls -tll (or -llt): list files starting by the most recently modified
lsusb – list usb (list buses and the devices connected to them)
lsusb : list all the buses and devices
lsusb -v : list full detailed information
lsusb -s bus:dev : displays the information for device 'dev' in bus 'bus'
example:
lsusb -s 001:003
mkdir – make directory
mkdir /home/test : will create a directory inside the home directory (/home)
more – to view the content of a big file with the possibility of scrolling line by line with the keyboard. (See cat | more)
nmap – network mapping (scanning)
nmap 192.18.86.1/24 -sn (no port scan)
ping – network testing
ping google.com
or
ping 8.8.8.8
or
ping xxx.yyy.aaa.bbb
or
ping -c 3 8.8.8.8 (ping 3 times)
ps – list processes
ps -aux (or ps aux) : shows the active processes with the following options:
a = show processes for all users
u = display the process's user/owner
x = also show processes not attached to a terminal
rm – remove (file or directory)
rm *.php : will remove all php files in the directory
rm -rf /home/pi/test : will remove the directory test whether it is empty or not (DANGEROUS command)
rmdir – remove a directory
rmdir /home/test : will remove the directory 'test' if it is empty
rsync – remote synchronization
# rsync [options] source destination
example:
rsync -avzh /mnt/syno_public/ /mnt/nas_pi/Public/
Can find a detailed explanation of rsync here.
scp – secure copy
remote file to local directory:
scp username@remotehost:foobar.txt /some/local/directory
or
local file to remote directory
scp foobar.txt username@remotehost:/some/remote/directory
To copy a folder from a remote host, use the following:
scp -r username@remotehost:/path/to/folder /some/local/directory
sed – stream editor (used to search and replace string inside a file (or several files)
sed -i 's/old_text/new_text/g' input.txt (will replace old_text by new_text in the file input.txt)
Note: if /g is omitted,only the first instance encountered will be replaced.
sed -i 's/old_text/new_text/g' *.php (will replace old_text by new_text in all php files.
smbpasswd – add samba user
smbpasswd -a test : add user 'test' to samba usergroup
ssh – Secure Shell
ssh user@IP_ADDRESS -p port
example
ssh root@192.168.86.53 -p 55
(port 55 needs to be defined in sshd_config)
(if port is omitted, port 22 is used by default)
tail – list the last part of a file
tail -n 1 /home/test/test.log : will show the last line of test.log file
tail -f /home/test/test.log
tee –
something
top – list processes and resources
top
traceroute
traceroute [options] host_Address [pathlength]
[options] -4 for IPV4 or -6 for IPV6
example:
traceroute -4 homeyann.duckdns.org will provide the following result:

uname – get system identification
uname returns Linux
uname -r returns the release
uname -a returns detailed information

useradd – create a user account
useradd toto : will create a user 'toto'. The system will ask several questions related to the new user (enter password twice, address,...). Answers are optional, expect for the last question. One the user is created, there will be a new directory created under /home/toto
usermod -a -G : add user to group
usermod -a -G www-data test : add user 'test' to group 'www-data'
wc (count number of lines, words, characters,…):
wc /home/filename returns the number of lines, words and characters
wc -l /home/filename returns the number of lines
wc -w /home/filename returns the nuber of words
wc -m /home/filename returns the number of characters
wc -c /home/filename returns the number of bytes
wc -L /home/filename returns the length of the longest line