Page 1 of 1

Different Sets of commands utilities...

PostPosted: Sat Jan 17, 2015 10:07 am
by Vipin
Hi,

Here I have got some set of Linux commands which I hope would be useful for you guys. :D

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

Different Sets of commands utilities

PostPosted: Wed Mar 11, 2015 11:51 am
by Dinulya
Most of the following commands will need to be prefaced with the sudo command. This elevates privileges to the root-user administrative level temporarily, which is necessary when working with directories or files not owned by your user account. When using sudo you will be prompted for your password. Only users with sudo administrative privileges will be able to use this command. You should never use normal sudo to start graphical applications as Root.