Shell Script
File exists
With the if statement
FILE=/etc/resolv.conf
if [ -f "$FILE" ]; then
echo "$FILE exists."
else
echo "$FILE does not exist."
fiWith the "&&" operator
[ -f /etc/resolv.conf ] && echo "File exists!"Folder exists
if [ "$(ls -A /tmp)" ]; then
echo "Exists and is not Empty"
fi
# Or using `-d`
if ! [ -d "/var/www/html" ] || ! [ -d "/var/www/x-html" ]; then
echo "Folder not found here - ;("
fiOr not exists
Find differences between foldes
Show ports in use
Create alias
Cheatsheet of multiple commands
Read every line from a file
Log
Basic view of records
Last updated