BASIC LINUX COMMANDS:
piping (|):
In simple terms you take the output of something and redirect it into another destination for further processing
mv:
The mv command can move files and or directories to new places or rename files or folders
Here is the general syntax:
mv ./somefolder /some/path/
For more info use man mv or mv --help
cp:
cp command will copy folders or files but you must specify where you want to copy the files or folder at.
The general syntax would be:
cp . /some/path/
You can use arguments or flags such as -v which is verbose and it will show you what the command is doing
Use man cp or cp --help for more info
cd:
It is a really easy command and simple to use and the most important one of them all. It allows you to navigate around your system via changing directories using the terminal.
Here are some basic commands that you should know:
cd --
The command above allows you to go back to the previous directory
cd ..
This will take you back a directory. For example, if you are in
/home/user/stuff
It will take you to
/home/user
cd ./
or
cd name-of-sub-directory
cd into a subdirectory that is inside the parent directory
use man cd or cd --help for more info
ls:
ls command will output whatever is inside a directory. you can find out where you're at if you just type pwd
For more info use man ls or ls --help
lsblk:
lsblk literally just lists all the storage devices that are running on your system
For example:
lsblk
Would output this:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 4K 1 loop /snap/bare/5
loop1 7:1 0 63.9M 1 loop /snap/core20/2105
loop3 7:3 0 63.5M 1 loop /snap/core20/2015
loop4 7:4 0 246M 1 loop /snap/firefox/3626
loop5 7:5 0 349.7M 1 loop /snap/gnome-3-38-2004/140
loop6 7:6 0 349.7M 1 loop /snap/gnome-3-38-2004/143
loop7 7:7 0 91.7M 1 loop /snap/gtk-common-themes/1535
loop8 7:8 0 111.9M 1 loop /snap/lxd/24322
loop9 7:9 0 73.9M 1 loop /snap/core22/864
loop11 7:11 0 496.9M 1 loop /snap/gnome-42-2204/132
loop12 7:12 0 262.1M 1 loop /snap/firefox/3728
loop13 7:13 0 40.4M 1 loop /snap/snapd/20671
loop14 7:14 0 497M 1 loop /snap/gnome-42-2204/141
loop15 7:15 0 74.1M 1 loop /snap/core22/1033
loop16 7:16 0 40.9M 1 loop /snap/snapd/20290
loop17 7:17 0 114.4M 1 loop /snap/lxd/26741
sr0 11:0 1 1024M 0 rom
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /boot/efi
├─nvme0n1p2 259:2 0 2G 0 part /boot
└─nvme0n1p3 259:3 0 235.4G 0 part
└─ubuntu--vg-ubuntu--lv
The example above you can run, however, the output will be different. Use man lsblk or lsblk --help for more options
cat:
cat is a command that you can use to output a file contents.
For example:
cat /home/user0/some_text.txt
Note that it will work on any kind of file extension, but be warned there are some files you do not want to use cat on >:D
Use man cat or cat --help for more details
grep:
grep is a very power tool you can use in any kind of linux distro.
You use grep to filter out your output if you use cat,ls,etc
For example:
lsblk | grep "MOUNTPOINTS"
For more info use man grep or grep --help
BASIC LINUX NETWORK COMMANDS:
IFCONFIG
ifconfig allows you to list the network interfaces that are on your machine
Here is an example of what the output of ifconfig looks like:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:c6:94:ad:ae txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.96.207 netmask 255.255.255.192 broadcast 192.168.96.255
inet6 fe80::a6bb:6dff:fed8:3ab3 prefixlen 64 scopeid 0x20 <link >
ether a4:bb:6d:d8:3a:b3 txqueuelen 1000 (Ethernet)
RX packets 23443420 bytes 14193700153 (14.1 GB)
RX errors 0 dropped 53821 overruns 0 frame 0
TX packets 11006636 bytes 2598617384 (2.5 GB)
TX errors 7 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10 <host>
loop txqueuelen 1000 (Local Loopback)
RX packets 342663 bytes 38575469 (38.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 342663 bytes 38575469 (38.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ROUTE
route allows you to check the routing of your machine or you can use it to manipulate your ip routing tables.
if you just run route, you will get a similar output:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default _gateway something UG 100 0 0 enp2s0
one.one.one.one _gateway something UGH 100 0 0 enp2s0
dns.google _gateway something UGH 100 0 0 enp2s0
172.17.0.0 something something U 0 0 0 docker0
192.168.96.192 something something U 100 0 0 enp2s0
_gateway something something UH 100 0 0 enp2s0
We will not discuss what ip routing tables are cause that is something advance
SS:
ss (ss is the replacement tool for netstat)
ss is a common Linux utility for performing an inventory of network resources being used on a machine. Examine the man page for ss to determine the 4 flags that you can pass the tool to list all TCP sockets in a LISTEN state on an IPv4 address and the process that is using it.
man ss
LSOF
Warning: You will need to install the package if the command does not work.
The lsof utility lists all file descriptors that are open on the machine across all of its processes. As network connections are accessed via file descriptors, they may also be listed using lsof. Back on the Linux VM, find the number of open descriptors using the following command.
sudo lsof | wc -l
Examine the man page for lsof for more details or use lsof --help
NC
Warning: You will need to install the package if the command does not work.
netcat (nc) is a program that can connect to arbitrary ports on a server. Examine the man page for nc. Then, on the Linux VM, use the command to connect up to the ssh port of webpages.sou.edu.
Examine the man page for more details or use nc --help

