3. id
This is the counterpart to the $UID, $EUID, and $GROUPS internal Bash variables.
bash$ id
uid=501(bozo) gid=501(bozo) groups=501(bozo),22(cdrom),80(cdwriter),81(audio)
bash$ echo $UID
501
4.lid
[sankar@new-host perlscript]$ logname
sankar
[sankar@new-host perlscript]$ whoami
sankar
[sankar@new-host perlscript]#logname
sankar
[sankar@new-host perlscript]#whoami
root
sankar
[sankar@new-host perlscript]#whoami
root
[sankar@new-host perlscript]$ ac
total 26.20
[sankar@new-host perlscript]$ last
sankar pts/5 :0 Tue Sep 4 11:08 still logged in
sankar :0 Tue Sep 4 09:30 still logged in
sankar :0 Tue Sep 4 09:30 - 09:30 (00:00)
xavier pts/2 :2.0 Tue Sep 4 09:29 still logged in
root pts/1 :1.0 Tue Sep 4 09:29 still logged in
reboot system boot 2.6.18-194.3.1.e Tue Sep 4 09:28 (06:30)
sankar :0 Mon Sep 3 17:57 - 18:35 (00:38)
sankar :0 Mon Sep 3 17:57 - 17:57 (00:00)
xavier pts/2 :2.0 Mon Sep 3 17:56 - down (00:39)
root pts/1 :1.0 Mon Sep 3 17:56 - down (00:39)
reboot system boot 2.6.18-194.3.1.e Mon Sep 3 17:55 (00:39)
wtmp begins Mon Sep 3 17:03:14 2012
[sankar@new-host perlscript]$ last reboot
reboot system boot 2.6.18-194.3.1.e Tue Sep 4 09:28 (06:31)
reboot system boot 2.6.18-194.3.1.e Mon Sep 3 17:55 (00:39)
stty: Shows and/or changes terminal settings.
9. setterm
bash$ setterm -cursor off
bash$
|
The setterm command can be used within a script to change the appearance of text written to stdout, although there are certainly better tools available for this purpose.
setterm -bold on
echo bold hello
setterm -bold off
echo normal hello
|
bash$ tset -r
Terminal type is xterm-xfree86.
Kill is control-U (^U).
Interrupt is control-C (^C).
|
# From /etc/pcmcia/serial script:
IRQ=`setserial /dev/$DEVICE | sed -e 's/.*IRQ: //'`
setserial /dev/$DEVICE irq 0 ; setserial /dev/$DEVICE irq $IRQ
|
$ nc localhost.localdomain 25 220 localhost.localdomain ESMTP Sendmail 8.13.1/8.13.1; Thu, 31 Mar 2005 15:41:35 -0700
$ procinfo | grep Bootup Bootup: Wed Mar 21 15:15:50 2001 Load average: 0.04 0.21 0.34 3/47 6829
$ lsdev Device DMA IRQ I/O Ports ------------------------------------------------ cascade 4 2 dma 0080-008f dma1 0000-001f dma2 00c0-00df fpu 00f0-00ff ide0 14 01f0-01f7 03f6-03f6 ...
$ du -ach 1.0k ./wi.sh 1.0k ./tst.sh 1.0k ./random.file 6.0k . 6.0k total
$ stat test.cru File: "test.cru" Size: 49970 Allocated Blocks: 100 Filetype: Regular File Mode: (0664/-rw-rw-r--) Uid: ( 501/ bozo) Gid: ( 501/ bozo) Device: 3,8 Inode: 18185 Links: 1 Access: Sat Jun 2 16:40:24 2001 Modify: Sat Jun 2 16:40:24 2001 Change: Sat Jun 2 16:40:24 2001
23. $ ps a | grep mingetty
2212 tty2 Ss+ 0:00 /sbin/mingetty tty2
2213 tty3 Ss+ 0:00 /sbin/mingetty tty3
2214 tty4 Ss+ 0:00 /sbin/mingetty tty4
2215 tty5 Ss+ 0:00 /sbin/mingetty tty5
2216 tty6 Ss+ 0:00 /sbin/mingetty tty6
4849 pts/2 S+ 0:00 grep mingetty
bash$ pgrep mingetty
2212 mingetty
2213 mingetty
2214 mingetty
2215 mingetty
2216 mingetty
28. losetup
The usbmodules command outputs information about the driver modules for connected USB devices.
$ lsusb
Bus 001 Device 001: ID 0000:0000
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.00
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0000
idProduct 0x0000
. . .
- 36. ulimit
- Sets an upper limit on use of system resources. Usually invoked with the -f option, which sets a limit on file size (ulimit -f 1000 limits files to 1 meg maximum). [7] The -t option limits the coredump size (ulimit -c 0 eliminates coredumps). Normally, the value of ulimit would be set in /etc/profileand/or ~/.bash_profile
$ ldd /bin/ls
libc.so.6 => /lib/libc.so.6 (0x4000c000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
The default is two-second intervals, but this may be changed with the -n option.
watch -n 5 tail /var/log/messages
# Shows tail end of system log, /var/log/messages, every five seconds.
|
40.vol_id - probe filesystem type and read label and uuid.
vol_id supports
all common filesystem formats and detects various raid setups.vol_id is usually called from a udev rule
OPTIONS
--export
print all values in key/value format to import them into the
environment.
-t print the filesystem type
-l print the label of a volume
41. bash$ ps a | grep mingetty 2212 tty2 Ss+ 0:00 /sbin/mingetty tty2 2213 tty3 Ss+ 0:00 /sbin/mingetty tty3 2214 tty4 Ss+ 0:00 /sbin/mingetty tty4 2215 tty5 Ss+ 0:00 /sbin/mingetty tty5 2216 tty6 Ss+ 0:00 /sbin/mingetty tty6 4849 pts/2 S+ 0:00 grep mingetty 42. bash$ pgrep mingetty 2212 mingetty 2213 mingetty 2214 mingetty 2215 mingetty 2216 mingetty
sankar@new-host ~]$ /sbin/pidof chrome
12322 11382 8787 8301 7375 6771 6737 6713 6712 6707
[sankar@new-host ~]$ /sbin/fuser -u /usr/bin/vim
/usr/bin/vim: 13042e(sankar)
bash$ fuser -u /dev/null /dev/null: 3009(bozo) 3010(bozo) 3197(bozo) 3199(bozo)
bash$ fuser -um /dev/usbdrive
/mnt/usbdrive: 1772c(bozo)
root# fuser -un tcp 25List or change hard disk parameters. This command must be invoked as root, and it may be dangerous if misused.
47. lsusb
25/tcp: 2095(root)
The fuser command, invoked with the -n option identifies the processes accessing a port
46. hdparm
The lsusb command lists all USB (Universal Serial Bus) buses and the devices hooked up to them.
[sankar@new-host ~]$ /sbin/lsusb
Bus 002 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 003 Device 002: ID 04f3:0230 Elan Microelectronics Corp.
Bus 001 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
------------------------
bash$ lsusb Bus 001 Device 001: ID 0000:0000 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.00 bDeviceClass 9 Hub bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x0000 idProduct 0x0000
[sankar@new-host ~]$ /sbin/lspci
00:00.0 Host bridge: Intel Corporation 82865G/PE/P DRAM Controller/Host-Hub Interface (rev 02)
00:02.0 VGA compatible controller: Intel Corporation 82865G Integrated Graphics Controller (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c2)
00:1f.0 ISA bridge: Intel Corporation 82801EB/ER (ICH5/ICH5R) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801EB/ER (ICH5/ICH5R) IDE Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801EB (ICH5) SATA Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801EB/ER (ICH5/ICH5R) SMBus Controller (rev 02)
00:1f.5 Multimedia audio controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) AC'97 Audio Controller (rev 02)
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
52. ldd
bash$ ldd /bin/ls libc.so.6 => /lib/libc.so.6 (0x4000c000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) |
No comments:
Post a Comment