sajang@ubuntu64:~/Documents/cpp$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 94G 13G 76G 15% /
udev 492M 4.0K 492M 1% /dev
tmpfs 200M 764K 199M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 500M 152K 500M 1% /run/shm
ubuntu-share 298G 108G 190G 37% /media/sf_ubuntu-share
sajang@ubuntu64:~/Documents/cpp$ df -h | cut -d" " -f2- | sed 's/^ *//g'
Size Used Avail Use% Mounted on
94G 13G 76G 15% /
492M 4.0K 492M 1% /dev
200M 764K 199M 1% /run
5.0M 0 5.0M 0% /run/lock
500M 152K 500M 1% /run/shm
298G 108G 190G 37% /media/sf_ubuntu-share
sajang@ubuntu64:~/Documents/cpp$ df -h | cut -d" " -f2- --complement
Filesystem
/dev/sda1
udev
tmpfs
none
none
ubuntu-share
Friday, November 4, 2011
Tuesday, November 1, 2011
UNIX & GNU/Linux --- How to printout a text file in the reverse order: cat & tac
Sometimes, we can feel a kind of urge to print out a text file in the reverse order. (For example, dmesg log file). Maybe you want to try `tac', the reverse of `cat'. The below is an example:
=================================================
텍스트 파일을 stdout에 출력할 때 cat, more, tail 따위를 많이 쓰시지요.
가끔은 텍스트 파일을 (로그 파일같은 것은) 밑에서부터 거꾸로 읽고 싶은 욕구가 강하게 치밀지요.
이럴 때 한 번 써보세요: tac 아래 활용례 나갑니다.
=================================================
sajang@ubuntu64:~$ cat /var/log/dmesg | tail
[ 22.567973] NET: Registered protocol family 31
[ 22.567979] Bluetooth: HCI device and connection manager initialized
[ 22.567984] Bluetooth: HCI socket layer initialized
[ 22.567985] Bluetooth: L2CAP socket layer initialized
[ 22.571909] Bluetooth: SCO socket layer initialized
[ 22.583921] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 22.583922] Bluetooth: BNEP filters: protocol multicast
[ 22.584569] Bluetooth: RFCOMM TTY layer initialized
[ 22.584573] Bluetooth: RFCOMM socket layer initialized
[ 22.584575] Bluetooth: RFCOMM ver 1.11
sajang@ubuntu64:~$ tac /var/log/dmesg | head
[ 22.584575] Bluetooth: RFCOMM ver 1.11
[ 22.584573] Bluetooth: RFCOMM socket layer initialized
[ 22.584569] Bluetooth: RFCOMM TTY layer initialized
[ 22.583922] Bluetooth: BNEP filters: protocol multicast
[ 22.583921] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 22.571909] Bluetooth: SCO socket layer initialized
[ 22.567985] Bluetooth: L2CAP socket layer initialized
[ 22.567984] Bluetooth: HCI socket layer initialized
[ 22.567979] Bluetooth: HCI device and connection manager initialized
[ 22.567973] NET: Registered protocol family 31
=================================================
텍스트 파일을 stdout에 출력할 때 cat, more, tail 따위를 많이 쓰시지요.
가끔은 텍스트 파일을 (로그 파일같은 것은) 밑에서부터 거꾸로 읽고 싶은 욕구가 강하게 치밀지요.
이럴 때 한 번 써보세요: tac 아래 활용례 나갑니다.
=================================================
sajang@ubuntu64:~$ cat /var/log/dmesg | tail
[ 22.567973] NET: Registered protocol family 31
[ 22.567979] Bluetooth: HCI device and connection manager initialized
[ 22.567984] Bluetooth: HCI socket layer initialized
[ 22.567985] Bluetooth: L2CAP socket layer initialized
[ 22.571909] Bluetooth: SCO socket layer initialized
[ 22.583921] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 22.583922] Bluetooth: BNEP filters: protocol multicast
[ 22.584569] Bluetooth: RFCOMM TTY layer initialized
[ 22.584573] Bluetooth: RFCOMM socket layer initialized
[ 22.584575] Bluetooth: RFCOMM ver 1.11
sajang@ubuntu64:~$ tac /var/log/dmesg | head
[ 22.584575] Bluetooth: RFCOMM ver 1.11
[ 22.584573] Bluetooth: RFCOMM socket layer initialized
[ 22.584569] Bluetooth: RFCOMM TTY layer initialized
[ 22.583922] Bluetooth: BNEP filters: protocol multicast
[ 22.583921] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 22.571909] Bluetooth: SCO socket layer initialized
[ 22.567985] Bluetooth: L2CAP socket layer initialized
[ 22.567984] Bluetooth: HCI socket layer initialized
[ 22.567979] Bluetooth: HCI device and connection manager initialized
[ 22.567973] NET: Registered protocol family 31
Subscribe to:
Posts (Atom)