Labels

algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)

Linux Notes Part 1

root@v11geonode2> cat /etc/passwd
root:x:0:0:Super-User:/root:/sbin/sh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:

USERNAME : PASSWORD:USERID:GROUPID

the password encrypted is stored at /etc/shadow

vin:$1$3vD2BLH4$ZEFSMbnDYrJ4YGEqzKDR0/:14734:7:91:7:::
user2:$1$19HkQt88$DBFe7VgQpGdd7osh9Oe8m1:14735:7:91:7:::
vin1:$1$0YwoL0i8$/Jg7ZnPs50lxlSax3Nc5C0:14742:7:91:7:::

logout

  1. logout
  2. exit
  3. control D

Shutdown

  1. halt :  shut down and halt.
  2. Init 0/6 : run level 0 is halt and 6 is reboot.
  3. shutdown –r/h h=halt r=reboot
  4. poweroff
  5. reboot
  6. restart

Shells

  1. bourne shell sh
  2. csh-c shell csh
  3. ksh-korn shell(is the most powerfull shell) ksh
  4. bash bourne again. bash

 

COMMAND OPTIONS ARGUEMENTS
internal/external character or string optional
     

 

Who Am I [aka who –m] : tells who the logged in user is

root@v11geonode2> who am i
root       pts/2        Jun 14 12:18    (10.142.208.146)

user      terminal    Login Time     IP-Address

actually who with any two options will return the same

you can actually type who mom likes / who dad likes tooo

WHO : all the users

root@v11geonode2> who
rtp99      pts/1        Jun 14 11:16    (10.142.216.148)
root       pts/3        Jun 14 12:20    (10.142.216.164)
root       pts/4        Jun 14 12:27    (10.142.216.158)
root       pts/7        Jun 14 10:34    (10.142.216.158)

-U gives idle time

id

[trainee@localhost /]$ id
uid=500(trainee) gid=500(trainee) groups=500(trainee) context=user_u:system_r:unconfined_t
[trainee@localhost /]$ id -u
500
[trainee@localhost /]$ id -g
500
[trainee@localhost /]$ id -G
500
[trainee@localhost /]$ id -nu
trainee
[trainee@localhost /]$ id -ng
trainee
[trainee@localhost /]$ id -nG
trainee

about Us

root@v11geonode2> logname
root
root@v11geonode2> tty
/dev/pts/2

Hardware Information

[trainee@localhost /]$ uname -s
Linux
[trainee@localhost /]$ uname -o
GNU/Linux
[trainee@localhost /]$ uname -p
i686
[trainee@localhost /]$ uname -m
i686
[trainee@localhost /]$ uname -n
localhost.localdomain
[trainee@localhost /]$ uname -r
2.6.18-8.el5
[trainee@localhost /]$ uname -v
#1 SMP Fri Jan 26 14:15:21 EST 2007
[trainee@localhost /]$ uname -a
Linux localhost.localdomain 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux

Date

Mon Jun 14 13:03:43 IST 2010

Changing password

root@v11geonode2> passwd
passwd: Changing password for root
New Password:

root can set some stupid and simple passwords.

Calculator(powerful but not user friendly)

[trainee@localhost /]$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
2+3
5

x=2
y=3
z=x+y
print z
5

quit

Linux has 10k commands so …learn to use the manual[Manual pages]

man [Command]

  • man kill
  • man -k kill : lists all the sections where the command is there.[trainee@localhost /]$ man -k kill
    kill                 (1p)  - terminate or signal processes
    kill                 (1)  - terminate a process
    kill                 (2)  - send signal to a process
  • man 2 kill      where 2 is the section ie the one in the bold above

info

more user friendly help

it has hyper links in the form of *[Star]

--help

only few commands support this , brief explanation

whatis kill

lists the sections

1 comment:

Search 24 Bytes

Loading...