Monday, December 26, 2005

Command Tips

Creating a list of users :

Create a list of users in a password-like file and run the command

[sriram@mybox sriram] newusers filename

Disable a User account :

passwd -l username

To enabe a User Account :

passwd -u username

Cron tricks
  Instead of the first five fields, one of eight special strings may

string meaning
------ -------
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".

Hmm. @reboot. Isn't that handy. There's an easy way to give users the ability to run something at boot time without root access.

Modes made easy

chmod g+w adds group write without changing other permission.
chmod o-a removes all permissions for others.
chmod u=rw gives read/write file permission to the owner.

Killing Process :

Suppose you want to kill galeon

do a ps -auxwww |grep

and now kill path to the program

For Eg :
[root@mybox sriram]# killall /usr/bin/galeon-bin - This will kill galeon.

Expire Passwords :
[sriram@mybox sriram]passwd -x 30 sriram

Forces sriram to change his password after 30 days.

Directories made easy :
If you want to create multiple directories in /home/sriram

Say a, b, and c.

[sriram@mybox sriram]mkdir -p /home/sriram/a/b/c

To See which all group a user belongs
[sriram@mybox sriram] id -Gn <--- This has effectively replaced groups and whoami To

See machine architecture

[sriram@mybox sriram] arch


No comments: