1) i need to display permission of a given file in the following format :
Owner :
Read
Write
Group :
Read
Write
Others :
Read
Execute
so i wrote this code :
Code:
echo -n "Enter Filename : " ; read fname ;
# check if file exists
if [ -e $fname ]
then
#display fap for owner
echo "Owner"
ls -l $fname|awk '{print $1 }' |tee temp | cut -c2-4
#display fap for group users
echo "Group"
cat temp | cut -c5-7
#display fap for other users
echo "Other"
cat temp | cut -c8-10
else
echo "FIle does not exist"
fi
Code:
Owner rwx Group r-x Others r--
2) i need to delete all duplicate files ,
so i wrote this,
Code:
find . -maxdepth 1 -type f -print0 | xargs -0 md5sum | sort | uniq -w 32 -c | awk '{ print $1, $3 }' | find -ok rm {} \;
3) Need to check if any user has logged-in more than once in different terminal, then display the no. of instances of that login.
Sorry , no code tried for this one. I dont know where to start from.
4) And im trying to display files that have been created today ,
as i understand , unix keeps the track of files by the modification date and doesn't store the creation date, so how do i accomplish this task.
i have tried my best to solve these doubts by reading numerous tutorials . but still couldn't find my answers. Please help.
Thanks for reading the post.
