Chap 1: Your First Keystrokes
Chap 1: Your First Keystrokes
ex: %developers ALL(=ALL) NOPASSWD: ALL => grant the ‘developers’ group permission to
run any command on the system
sudo -lU <username> => a list of the sudo commands a user can run
Chap 15: What’s wrong with the Network
ping [options] host => testing network connectivity
ie. ping google.com
ping -c 2 10.2.0.0
ls /sys/class/net => list the available network interfaces on system
ip link show => view the available network interfaces
nmcli device status => see the connection status of each network interfaces
ifconfig <name_of _networkinterface> => checking IP address
ip address show => list the status of all ur network interfaces
netstat -rn =>check the IP address of ur default gateway
ip route
traceroute <destionation> => trace the route to any destination
ie. traceroute google.com
traceroute facebook.com
cat /etc/resolv.conf => view the IP addres of ur DNS (domaine name system) server
nslookup <domain_name> => to obtain the IP address of that domain name
ie. nslookup google.com
in root:
echo > /etc/resolv.conf =>break DNS of ur ISP (internet service provider)
echo “nameserver 8.8.8.8” > /etc/resolv.conf => fixing DNS, using Google’s public DNS server
8.8.8.8
ping <ur_hostname> => displaying ur computer’s IP address
hostnamectl => view ur computer’s hostname
hostnamectl set-hostname <new_hostname> => set new hostname
ifconfig <interface_name> down => turn off internet
ifconfig <interface_name> up => turn on internet
systemctl restart NetworkManager =>restart all ur network interfaces
crontab -e => edit and create cron jobs
crontab -l => list their cron jobs
A filesystem basically dictates how data is organized and stored on a disk (or partition)
mkfs –type [fstype] <disk_or_partition>
mkfs --type ext4 /dev/sdb1
file -s /dev/sdb1 => verify our work
wipefs -a /dev/sdb1 => remove a filesystem
Mounting refers to the process of attaching any filesystem or any storage device (USH flash
drives, CDs,…) to directory
The mount command only mounts a filesystem temporarily
mount <filesystem> <mount_directory>
ex: mkdir /games
mount /dev/sdb1 /games => use the filesystem /dev/sdb1 to store our games (mount our
filesystem on the /games directory)
mount | grep sdb1 => verify that /dev/sdb1 is mounted on /games
df -h /games => display the filesystem disk space usage
umount <filesystem>
ex: cd /games
umount /dev/sdb1
If you want to mount a filesystem permanently, then you need to include it in the filesystem
table file /etc/fstab
Each entry (or line) in /etc/fstab represents a different filesystem, and each line consists of the
following six fields:
So, for example, to mount our /dev/sdb1 filesystem on /games permanently, you need to include
the following line in /etc/fstab: /dev/sdb1 /games ext4 defaults 0 0
Now unmount /dev/sdb1: umount /dev/sdb1
mount /dev/sdb1 => Notice we did not specify a mount
destination this time, because the mount destination is already specified
in the /etc/fstab
cd /games
dd if=/dev/zero of=bigGame bs=1G count=1 = > create a 1GB file named bigGame
In some unfortune situations, you may run into an issue where your system will not boot because
of a corrupted filesystem
fsck -y /dev/sdb1 => check and repair filesystems