Different Sets of commands utilities...
Posted: Sat Jan 17, 2015 10:07 am
Hi,
Here I have got some set of Linux commands which I hope would be useful for you guys.
PERMISSIONS
To Know the Owning User for a File or Directory:
$ stat -c %U /Path to/file/
To Know the Owning group for a File or Directory:
$ stat -c %G /Path to/file/
To Know the Access rights of a File or Directory:
$ stat -c %A /Path to/file/
List files owned by a user or group with the find utility:
# find / -group [group]
# find / -user [user]
BULK chmod:
Generally directories and files should not have the same permissions. If it is necessary to bulk modify a directory tree, use find to selectively modify one or the other.
To chmod only directories to 755:
# find directory -type d -exec chmod 755 {} +
To chmod only files to 644:
# find directory -type f -exec chmod 644 {} +
DATE AND TIME
Set time and date:
# date -s "2 OCT 2006 18:00:00"
How do I set the Hardware Clock to the current System Time?
Use the following syntax:
# hwclock --systohc
CREATE ENCRYPTED PASSWORDS
# perl -e 'print crypt("password","\$6\$saltsalt\$") . "\n"'
or
# /sbin/grub-md5-crypt
TO KNOW SSL CERTIFICATE'S ISSUE AND EXPIRY DATE
ISSUE:
echo "QUIT" | openssl s_client -connect google.com:443 2>/dev/null | openssl x509 -noout -startdate 2>/dev/null
EXPIRY:
echo "QUIT" | openssl s_client -connect google.com:443 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null
Here I have got some set of Linux commands which I hope would be useful for you guys.
PERMISSIONS
To Know the Owning User for a File or Directory:
$ stat -c %U /Path to/file/
To Know the Owning group for a File or Directory:
$ stat -c %G /Path to/file/
To Know the Access rights of a File or Directory:
$ stat -c %A /Path to/file/
List files owned by a user or group with the find utility:
# find / -group [group]
# find / -user [user]
BULK chmod:
Generally directories and files should not have the same permissions. If it is necessary to bulk modify a directory tree, use find to selectively modify one or the other.
To chmod only directories to 755:
# find directory -type d -exec chmod 755 {} +
To chmod only files to 644:
# find directory -type f -exec chmod 644 {} +
DATE AND TIME
Set time and date:
# date -s "2 OCT 2006 18:00:00"
How do I set the Hardware Clock to the current System Time?
Use the following syntax:
# hwclock --systohc
CREATE ENCRYPTED PASSWORDS
# perl -e 'print crypt("password","\$6\$saltsalt\$") . "\n"'
or
# /sbin/grub-md5-crypt
TO KNOW SSL CERTIFICATE'S ISSUE AND EXPIRY DATE
ISSUE:
echo "QUIT" | openssl s_client -connect google.com:443 2>/dev/null | openssl x509 -noout -startdate 2>/dev/null
EXPIRY:
echo "QUIT" | openssl s_client -connect google.com:443 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null