Secure Linux Mounting Made Easy with These Bash Scripts Managing Linux file systems manually can often lead to errors or misconfigurations, especially when mounting Samba shares or unmounting an NFS path. To solve this challenge, a pair of secure Linux mount scripts can optimize your day-to-day sysadmin tasks. Designed with reliability in mind, these scripts aim to […]
# cat /etc/crontab (To read/print any file) # cat –n /etc/crontab (To print files with line number) # cat /etc/crontab /etc/passwd (To print multiple files together) # tac /etc/crontab (To print exact opposite output from cat command) # wc /etc/crontab (To print line, word, character count of file) # wc -l /etc/crontab (To print line […]
Quotes are very crucial in Bash Shell Scripting. These are used to define and delimit strings in shell or Shell scripts. It can disable the special treatment of a special character. It is also very helpful to prevent reserved words. You can use them to run commands in shell, Processing variables in shell, etc.There are […]
We can use below script to add host and ip entries in /etc/hosts file. $ cat append.sh #!/bin/bash ## Append hostname and IP in /etc/hosts file hostname=$1 ip=$2 /usr/bin/sshpass -p ‘password’ ssh user@$1 "echo password | sudo -S sh -c ‘echo "$2 $1 $1.example.com" >> /etc/hosts’" $ sh append.sh test-server 192.168.1.100 It will make entry […]
Recent Blog