Unix Commands

Adding a user
As root user.

Groups
What group am I


 * taken from http://www.cyberciti.biz/faq/which-groups-do-i-belong-to/

Add a existing user to existing group

 * taken from http://www.cyberciti.biz/faq/howto-linux-add-user-to-group/

.profile
SHELL=/usr/bin/bash PS1=$'\\[\\033[1;30m\\][\\[\\033[1;37m\\]\\\\u\\[\\033[0;37m\\]@\\[\\033[1;37m\\]\\\\h\\ [\\033[1;30m\\]:\\[\\033[1;36m\\]\\W\\[\\033[1;30m\\]]\\[\\033[0;37m\\] ' alias ls='ls -F'


 * Bash history
 * Unix prompts

Advanced alias
alias df='df -h' alias du='du -h'
 * 1) Default to human readable figures

alias ls='ls -hF --color=tty'                # classify files in colour alias dir='ls --color=auto --format=vertical' alias ll='ls -l'                             # long list

Fixed IP Address

 * 1) cd /etc/sysconfig/network-scripts
 * 2) less ifcfg-eth0

DEVICE=eth0 IPADDR=192.168.1.100 NETMASK=255.255.255.0 BOOTPROTO=static ONBOOT=yes # # BROADCAST=192.168.1.255 NETWORK=192.168.1.0
 * 1) The following settings are optional

Getting the IP Address Using DHCP

 * 1) cd /etc/sysconfig/network-scripts
 * 2) less ifcfg-eth0

DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes

Snoop
snoop -o network.snoop port 8080

Untar

 * x = eXtract, this indicated an extraction ( c = create to create )
 * v = verbose (optional) the files with relative locations will be displayed.
 * z = gzip-ped; j = bzip2-zipped
 * f = from/to file ... (what is next after the f is the archive file)


 * taken from http://how-to.wikia.com/wiki/How_to_untar_a_tar_file_or_gzip-bz2_tar_file

rpm

 * RPM

yum

 * Downgrading packages

output redirect
also works in 4NT

find files
taken from http://www.athabascau.ca/html/depts/compserv/webunit/HOWTO/find.htm

Set Date, Time, and Zone

 * http://www.cyberciti.biz/faq/howto-set-date-time-from-linux-command-prompt/
 * http://www.wikihow.com/Change-the-Timezone-in-Linux

ntp
if using ntp

Immediately reset the clock to the correct time

services
start

stop

uptime

killall
kill all processes

kill all tomcats
beware that this will kill everything being run by java!.

error: cannot open Conflictname index using db3
With error: error: cannot open Conflictname index using db3 - No such file or directory (2) error: can't create transaction lock on /var/lib/rpm/__db.000

Solve:
 * 1) rm -rf /var/lib/rpm/__db.*
 * 2) rpm --rebuilddb

Navigating

 * CTRL-A = go to beginning of line
 * CTRL-E = go to end of line
 * CTRL-T = transpose two letters