Daily Tasks of Dba
Daily Tasks of Dba
# lsb_release -a
# cat /proc/version
# arch
# dd if=/dev/cdrom of=/tmp/ubuntu
# $ cd ../../../..
To Here
/home/sysadmin/Desktop/tmp
Automatically Correct Mistype Directory Names, this will check the spell and if its
wrong while we type it will make correct automatically
shopt -s cdspell
Grep Commands
Grep and its Options
-v = non-matching lines
-c = count of matching lines
-i = Ignore case
-r = Read all files under each directory
-l = list the file which contain the searching keyword
^ = Search the Starting word of a file
.$ = Search the end word of a file
^$ = Search the empty lines in a file
Search for subdirectories for a text matching a specific partern and list the files which the
keyword contain
grep -c ^$ /var/log/mail.log
Find commands
Syntax:
Which Dont have to show for the mail just show the student files
find / -size 2G
Find the files that are not modified in last number of days
find / -mtime -2
Find the unmodified files and list which more than 30 days old
Delete all the archive files with extension *.tar.gz and greater than 100MB
To Copy
To find the total Size of files for a particular User in Current Directory
find . -type f -user sysadmin -printf "%s\n" | awk '{t+=$1}END{print t}'
Archive all the files that are not modified in the last x number of days
To find large file more than 50MB size inside a Directory and subdirectory
xargs Command
wget commands
# wget -i list_to_download_from_file.txt
Sort Command
Stat Command
stat test.txt
stat -f test.txt
Diff Commands
Watch Command
watch vmstat
AC Commands
ac -d
ac -p
ac -d sysadmin