
Terminal - Commands by mhs - 29 results
NSPR_LOG_MODULES=nsHostResolver:5 NSPR_LOG_FILE=/tmp/log.txt firefox
This is sample output - yours may be different.
This is sample output - yours may be different.
i=in.swf; dump-gnash -1 -j 1280 -k 720 -D "${i%.*}"
[email protected] -A "${i%.*}".wav "${i}"
This is sample output - yours may be different.
This will dump a raw BGRA pixel stream and WAV which must then be converted to video:
ffmpeg -f rawvideo -c:v rawvideo -s 1280x720 -r 12 -pix_fmt bgra -i "${i%.*}".bgra -c:v libx264 -preset veryslow -qp 0 -movflags +faststart -i "${i%.*}".wav -c:a libfdk_aac -b:a 384k "${i%.*}".mp4 ; rm "${i%.*}".bgra "${i%.*}".wav
Our example generates an x264/720p/12fps/AAC best-quality MP4.
To get dump-gnash, first install the build-dependencies for gnash (this step is OS-specific). Then:
git clone http://git.savannah.gnu.org/r/gnash.git ; cd gnash ; ./autogen.sh ; ./configure --enable-renderer=agg --enable-gui=dump --disable-menus --enable-media=ffmpeg --disable-jemalloc ; make
udevadm info -q all -n /dev/sdc | grep ID_PATH | cut -d'-' -f 2 | xargs -n 1 lspci -s
This is sample output - yours may be different.
Useful for big systems with lots of cards.
(Update: does not work with USB disks)
lstopo -p -v --whole-system --whole-io output.svg
This is sample output - yours may be different.
dmidecode --type 9 |egrep 'Bus Address|Designation'
This is sample output - yours may be different.
Recent hardware may or may not enumerate *both of* these values
aptitude --purge remove ~i^foo ~i^bar
This is sample output - yours may be different.
Could be dangerous, if you have many packages all beginning with 'foo' or 'bar'. This will easily remove them all from your system.
This is sample output - yours may be different.
[ ! -d /squashed/usr ] && mkdir -p /squashed/usr/{ro,rw} ; mksquashfs /usr /squashed/usr/usr.sfs.new -b 65536 ; mv /squashed/usr/usr.sfs.new /squashed/usr/usr.sfs ; reboot
This is sample output - yours may be different.
Periodically run the one-liner above if/when there are significant changes to the files in /usr/
= Before rebooting, add following to /etc/fstab : =
/squashed/usr/usr.sfs /squashed/usr/ro squashfs loop,ro 0 0
usr /usr aufs udba=reval,br:/squashed/usr/rw:/squashed/usr/ro 0 0
No need to delete original /usr/ ! (unless you don't care about recovery). Also AuFS does not work with XFS
sdparm -s SCT=36000 --save /dev/sdb
This is sample output - yours may be different.
So I had this 2TB Seagate external disk/USB enclosure which by default would spin-down its internal drive (it enters a standby mode) after four minutes of inactivity.. Spinning-up the inactive drive was an annoying delay when accessing files and also it severely interfered with NFS.. SCT stands for "Standby Condition Timer".
To completely disable SCT:
sdparm --clear STANDBY -6 /dev/sdb
To return to original (default) SCT settings:
sdparm -D -p 0x1a -6 /dev/sdb
To verify the settings (before and after):
sdparm -a /dev/sdb
No need for vendor-provided MSWIN tools, etc.
prlimit --cpu=10 sort -u hugefile
This is sample output - yours may be different.
Similar to `cpulimit`, although `prlimit` can be found shipped with recent util-linux.
Example: limit CPU consumption to 10% for a math problem which ordinarily takes up 100% CPU:
Before:
bc -l <(echo "1234123412341234^12341234")
See the difference `prlimit` makes:
prlimit --cpu=10 bc -l <(echo "1234123412341234^12341234")
To actually monitor the CPU usage, use `top`, `sar`, etc.. or:
pidstat -C 'bc' -hur -p ALL 1
soffice --headless -convert-to odt:"writer8" somefile.docx
This is sample output - yours may be different.
In this example, the docx gets converted to Open Document .odt format.
For other formats, you'll need to specify the correct filter (Hint: see "Comments" link below for a nice list).
adb pull /dev/graphics/fb0 /dev/stdout | ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb32 -s 480x800 -i pipe:0 -f image2 -vcodec png screenshot.png
This is sample output - yours may be different.
Works with *rooted* Android devices. 400x800 are the screen dimensions of a typical handheld smartphone.
adb pull /data/data/com.android.providers.contacts/databases/contacts2.db ; sqlite3 -batch <<EOF contacts2.db <CR> .header on <CR> .mode tabs <CR> select * from data; <CR> EOF
This is sample output - yours may be different.
Crude, but works. Note for security, /data/ will be inaccessible unless your device has been *rooted*.
On the other hand, if a device has been rooted, its data is now wide open to anyone with a USB cable and the above "one-liner".
`adb` is one of the platform tools in the android SDK.
To get SMS messages:
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db ; sqlite3 -batch <<EOF contacts2.db <CR> .header on <CR> .mode tabs <CR> select * from sms; <CR> EOF
http_proxy=http://127.0.0.1:3128 wget --http-user='domain\account' --http-password='###' -p -r -l 8 --no-remove-listing -P . 'http://sp.corp.com/teams/Team/Shared%20Documents/Forms/AllItems.aspx?RootFolder=%2fteams%2fTeam%2fShared%20Documents%2fFolder'
This is sample output - yours may be different.
If you have to deal with MS Sharepoint which is (rarely, let's hope) used in e.g. certain corporate environments).
This uses Cntlm.
For single files, just use cURL -- its NTLM authentication works quite well.
# /etc/cntlm.conf:
# Username account
# Domain domain
# Password ############
# Proxy 10.20.30.40 (IP of the sharepoint site)
# NoProxy *
# Listen 3128
socat unix-connect:/tmp/socket stdio,echo=0,raw
This is sample output - yours may be different.
Create a serial console with "socket (named pipe)" of "/tmp/socket", "from:server, to:virtual machine" in vmware player, etc.. gui. Run the above command after you have booted the guest OS (which should also be configured for serial console).
for i in $(multipath -ll | grep "3PARdata,VV"|awk '{print $1}') ; do parted -a optimal /dev/mapper/$i --script -- mklabel gpt mkpart primary 1 -1 set 1 lvm on ; done
This is sample output - yours may be different.
`multipath -ll` requires Device Mapper multipath.conf configuration. And of course, replace "3PARdata,VV" with your disk array's SCSI vendor,LUN name.
- GPT partition table allows you to create >2TB partitions
for i in /sys/block/sd* ; do wwn=`/lib/udev/scsi_id -g -s /block/${i##*/}` ; [ "$wwn" != "" ] && echo -e ${i##*/}'\t'$wwn ;done
This is sample output - yours may be different.
# for i in /sys/block/sd* ; do wwn=`/lib/udev/scsi_id -g -s /block/${i##*/}` ; [ "$wwn" != "" ] && echo -e ${i##*/}'\t'$wwn ;done
sda 3600508b40009701f00017000005f0000
sdaa 350002ac0002c1bae
sdab 350002ac0002d1bae
sdac 350002ac0002d1bae
sdad 350002ac000311bae
sdae 350002ac000311bae
sdaf 350002ac000321bae
sdag 350002ac000321bae
sdah 350002ac000331bae
sdai 350002ac000331bae
sdaj 350002ac0005e1bae
sdak 350002ac0005e1bae
sdal 350002ac0005f1bae
sdam 350002ac0005f1bae
sdan 350002ac000601bae
sdao 350002ac000601bae
sdap 350002ac0003a1bae
sdaq 350002ac0003a1bae
sdar 350002ac0003b1bae
sdas 350002ac0003b1bae
sdat 350002ac0003c1bae
sdau 350002ac0003c1bae
sdav 350002ac000341bae
sdaw 350002ac000341bae
sdax 350002ac000351bae
sday 350002ac000351bae
sdaz 350002ac000361bae
sdb 3600508b40009701f00017000005f0000
sdba 350002ac000361bae
sdbb 350002ac000371bae
sdbc 350002ac000371bae
sdbd 350002ac000381bae
sdbe 350002ac000381bae
sdbf 350002ac000391bae
sdbg 350002ac000391bae
sdbh 350002ac0003d1bae
sdbi 350002ac0003d1bae
sdbj 350002ac0003e1bae
sdbk 350002ac0003e1bae
sdbl 350002ac0003f1bae
sdbm 350002ac0003f1bae
sdbn 350002ac0002e1bae
sdbo 350002ac0002e1bae
sdbp 350002ac0002f1bae
sdbq 350002ac0002f1bae
sdbr 350002ac000301bae
sdbs 350002ac000301bae
sdbt 350002ac000251bae
sdbu 350002ac000251bae
sdbv 350002ac000261bae
sdbw 350002ac000261bae
sdbx 350002ac000271bae
sdby 350002ac000271bae
sdbz 350002ac0002b1bae
sdc 3600508b40009701f00017000005f0000
sdca 350002ac0002b1bae
sdcb 350002ac0002c1bae
sdcc 350002ac0002c1bae
sdcd 350002ac0002d1bae
sdce 350002ac0002d1bae
sdcf 350002ac000311bae
sdcg 350002ac000311bae
sdch 350002ac000321bae
sdci 350002ac000321bae
sdcj 350002ac000331bae
sdck 350002ac000331bae
sdcl 350002ac0005e1bae
sdcm 350002ac0005e1bae
sdcn 350002ac0005f1bae
sdco 350002ac0005f1bae
sdcp 350002ac000601bae
sdcq 350002ac000601bae
sdcr 350002ac0003a1bae
sdcs 350002ac0003a1bae
sdct 350002ac0003b1bae
sdcu 350002ac0003b1bae
sdcv 350002ac0003c1bae
sdcw 350002ac0003c1bae
sdcx 350002ac000341bae
sdcy 350002ac000341bae
sdcz 350002ac000351bae
sdd 360014380024d1db50001a00000350000
sdda 350002ac000351bae
sddb 350002ac000361bae
sddc 350002ac000361bae
sddd 350002ac000371bae
sdde 350002ac000371bae
sddf 350002ac000381bae
sddg 350002ac000381bae
sddh 350002ac000391bae
sddi 350002ac000391bae
sddj 350002ac0003d1bae
sddk 350002ac0003d1bae
sddl 350002ac0003e1bae
sddm 350002ac0003e1bae
sddn 350002ac0003f1bae
sddo 350002ac0003f1bae
sddp 350002ac00055172e
sddq 350002ac00055172e
sddr 350002ac00055172e
sdds 350002ac00055172e
sddt 350002ac00055172e
sddu 350002ac00055172e
sddv 350002ac00055172e
sddw 350002ac00055172e
sddx 350002ac00055172e
sddy 350002ac00055172e
sddz 350002ac00055172e
sde 3600508b40009888a0001c00000d30000
sdea 350002ac00055172e
sdeb 350002ac00055172e
sdec 350002ac00055172e
sded 350002ac00055172e
sdee 350002ac00055172e
sdef 350002ac00055172e
sdeg 350002ac00055172e
sdeh 350002ac00055172e
sdei 350002ac00055172e
sdej 350002ac00055172e
sdek 350002ac00055172e
sdel 350002ac00055172e
sdem 350002ac00055172e
sden 350002ac0006b1bae
sdeo 350002ac0006b1bae
sdep 350002ac0006b1bae
sdeq 350002ac0006b1bae
sdf 360014380024d1db50001a00000350000
sdg 3600508b40009888a0001c00000d30000
sdh 360014380024d1db50001a00000350000
sdi 3600508b40009888a0001c00000d30000
sdj 360014380024d1db50001a00000350000
sdk 3600508b40009888a0001c00000d30000
sdl 350002ac0002e1bae
sdm 350002ac0002e1bae
sdn 350002ac0002f1bae
sdo 350002ac0002f1bae
sdp 350002ac000301bae
sdq 350002ac000301bae
sdr 350002ac000251bae
sds 350002ac000251bae
sdt 350002ac000261bae
sdu 350002ac000261bae
sdv 350002ac000271bae
sdw 350002ac000271bae
sdx 350002ac0002b1bae
sdy 350002ac0002b1bae
sdz 350002ac0002c1bae
Use `scsi_id` to positively identify which LUNs are which (i.e. compare with the list of LUNs you created on your disk array)
(shown: RHEL5 usage)
Debian usage:
# for i in /dev/sd* ; do wwn=`/lib/udev/scsi_id -g --device $i` ; [ "$wwn" != "" ] && echo -e ${i##*/}'\t'$wwn ;done
This is sample output - yours may be different.
# blkid -pi -c /dev/null /dev/sda
MINIMUM_IO_SIZE=512
PHYSICAL_SECTOR_SIZE=512
LOGICAL_SECTOR_SIZE=512
PTTYPE=dos
# blkid -c /dev/null
/dev/mapper/srv-lvol0: UUID="ff838430-4058-47a4-abf8-91362eb57ba1" TYPE="ext3"
/dev/mapper/VolGroup00-LogVol01: TYPE="swap"
/dev/mapper/VolGroup00-LogVol02: UUID="2ba64b56-9c0c-40e1-a17b-c1bfe2040007" TYPE="ext3"
/dev/mapper/VolGroup00-LogVol00: UUID="c22f3324-8c93-4bd3-b376-eed363e0c15f" TYPE="ext3"
/dev/cciss/c0d4: UUID="07bc6be5-6f4e-409a-940c-b5ba398dd7b5" TYPE="ext4"
/dev/cciss/c0d0p1: LABEL="/boot" UUID="0cfeec27-0c44-4991-a2cb-1e881dfb98c3" TYPE="ext3"
/dev/VolGroup00/LogVol00: UUID="c22f3324-8c93-4bd3-b376-eed363e0c15f" TYPE="ext3"
/dev/VolGroup00/LogVol01: TYPE="swap"
/dev/loop0: LABEL="NOLABEL" TYPE="iso9660"
/dev/loop1: LABEL="RMO_CDROM" TYPE="iso9660"
/dev/mapper/mpath4: UUID="07bc6be5-6f4e-409a-940c-b5ba398dd7b5" TYPE="ext4"
/dev/mapper/mpath29p1: LABEL="ORADATA001" TYPE="oracleasm"
/dev/mapper/mpath16p1: UUID="79028217-73cf-497c-bcb4-2bde1cbebdeb" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/mpath18p1: UUID="e361ac4f-a9d3-4250-a14c-1cac6881844f" SEC_TYPE="ext2" TYPE="ext3"
/dev/loop2: LABEL="INST_CD" TYPE="iso9660"
`blkid` is an interface to libuuid - it can read Device Mapper, EVMS, LVM, MD, and regular block devices.
-c /dev/null - Do not use cached output from /etc/blkid.tab or /etc/blkid/blkid.tab (RHEL)
-i - Display I/O Limits (aka I/O topology) information (not available in RHEL)
-p - Low-level superblock probing mode (not available in RHEL)
lsof -n -P|grep FlashXX|awk '{ print "/proc/" $2 "/fd/" substr($4, 1, length($4)-1) }'|while read f;do newname=$(exiftool -FileModifyDate -FileType -t -d %Y%m%d%H%M%S $f|cut -f2|tr '\n' '.'|sed 's/\.$//');echo "$f -> $newname";cp $f ~/Vids/$newname;done
This is sample output - yours may be different.
Certain Flash video players (e.g. Youtube) write their video streams to disk in /tmp/ , but the files are unlinked. i.e. the player creates the file and then immediately deletes the filename (unlinking files in this way makes it hard to find them, and/or ensures their cleanup if the browser or plugin should crash etc.) But as long as the flash plugin's process runs, a file descriptor remains in its /proc/ hierarchy, from which we (and the player) still have access to the file. The method above worked nicely for me when I had 50 tabs open with Youtube videos and didn't want to have to re-download them all with some tool.
exec -a "/sbin/getty 38400 tty7" your_cmd -erase_all_files
This is sample output - yours may be different.
$ exec -a "/sbin/getty 38400 tty7" your_cmd -erase_all_files
$ ps -ef
[...]
user1 8765 2655 0 18:39 pts/7 00:00:00 /sbin/getty 38400 tty7
[...]
exec -a $NAME $COMMAND $ARGS
`your_cmd -erase_all_files` is the real process, but harmless-looking getty appears in the process table.
Never actually had a need to do this, but interesting nonetheless... Tested in bash, dash.
-a $NAME
"pass NAME as the zeroth argument to COMMAND", i.e. customise the name of the process (as commonly seen with `ps`)
This is sample output - yours may be different.
# lshw -short
H/W path Device Class Description
=======================================================
system ProLiant DL380 G4
/0 bus Motherboard
/0/0 memory 64KiB BIOS
/0/400 processor Intel(R) Xeon(TM) CPU 3.80GHz
/0/400/710 memory 16KiB L1 cache
/0/400/720 memory 2MiB L2 cache
/0/400/730 memory L3 cache
/0/400/7.1 processor Logical CPU
/0/400/7.2 processor Logical CPU
/0/406 processor Intel(R) Xeon(TM) CPU 3.80GHz
/0/406/716 memory 16KiB L1 cache
/0/406/726 memory 2MiB L2 cache
/0/406/736 memory L3 cache
/0/406/7.1 processor Logical CPU
/0/406/7.2 processor Logical CPU
/0/1000 memory 10GiB System Memory
/0/1000/0 memory 2GiB DIMM DDR Synchronous 400 MHz (2
/0/1000/1 memory 2GiB DIMM DDR Synchronous 400 MHz (2
/0/1000/2 memory 2GiB DIMM DDR Synchronous 400 MHz (2
/0/1000/3 memory 2GiB DIMM DDR Synchronous 400 MHz (2
/0/1000/4 memory 1GiB DIMM DDR Synchronous 400 MHz (2
/0/1000/5 memory 1GiB DIMM DDR Synchronous 400 MHz (2
/0/100 bridge E7520 Memory Controller Hub
/0/100/2 bridge E7525/E7520/E7320 PCI Express Port A
/0/100/2/0 bridge 6700PXH PCI Express-to-PCI Bridge A
/0/100/2/0/1 eth0 network NetXtreme BCM5704 Gigabit Ethernet
/0/100/2/0/1.1 eth1 network NetXtreme BCM5704 Gigabit Ethernet
/0/100/2/0.2 bridge 6700PXH PCI Express-to-PCI Bridge B
/0/100/2/0.2/3 storage Smart Array 64xx
/0/100/6 bridge E7520 PCI Express Port C
/0/100/6/0 bridge 6700PXH PCI Express-to-PCI Bridge A
/0/100/6/0/1 bridge PI7C21P100 PCI to PCI Bridge
/0/100/6/0/1/4 eth2 network 82546GB Gigabit Ethernet Controller
/0/100/6/0/1/4.1 eth3 network 82546GB Gigabit Ethernet Controller
/0/100/6/0/1/6 eth4 network 82546GB Gigabit Ethernet Controller
/0/100/6/0/1/6.1 eth5 network 82546GB Gigabit Ethernet Controller
/0/100/6/0/2 scsi0 bus ISP2312-based 2Gb Fibre Channel to P
/0/100/6/0/2/0.0.0 generic SCSI
/0/100/6/0/2/0.1.0 generic SCSI
/0/100/6/0/2/0.2.0 generic SCSI
/0/100/6/0/2/0.3.0 generic SCSI
/0/100/6/0/2/0.4.0 generic SCSI
/0/100/6/0/2/0.4.1 /dev/sdd disk 1073MB SCSI Disk
/0/100/6/0/2/0.4.1/1 /dev/sdd1 volume 1023MiB EXT3 volume
/0/100/6/0/2/0.5.0 generic SCSI
/0/100/6/0/2/0.5.1 /dev/sde disk 1073MB SCSI Disk
/0/100/6/0/2/0.5.1/1 /dev/sde1 volume 1023MiB EXT3 volume
/0/100/6/0/2/0.8.0 generic SCSI
/0/100/6/0/2/0.a.0 generic SCSI
/0/100/6/0/2/0.b.0 generic SCSI
/0/100/6/0/2/0.c.0 generic SCSI
/0/100/6/0/2/0.6.0 generic SCSI
/0/100/6/0/2/0.6.1 /dev/sdi disk 1073MB SCSI Disk
/0/100/6/0/2/0.6.1/1 /dev/sdi1 volume 1023MiB EXT3 volume
/0/100/6/0.2 bridge 6700PXH PCI Express-to-PCI Bridge B
/0/100/6/0.2/1 scsi3 bus ISP2312-based 2Gb Fibre Channel to P
/0/100/6/0.2/1/0.1.0 generic SCSI
/0/100/6/0.2/1/0.1.1 /dev/sda disk 2147MB SCSI Disk
/0/100/6/0.2/1/0.2.0 generic SCSI
/0/100/6/0.2/1/0.2.1 /dev/sdb disk 2147MB SCSI Disk
/0/100/6/0.2/1/0.3.0 generic SCSI
/0/100/6/0.2/1/0.3.1 /dev/sdc disk 2147MB SCSI Disk
/0/100/6/0.2/1/0.4.0 generic SCSI
/0/100/6/0.2/1/0.4.1 /dev/sdh disk 2147MB SCSI Disk
/0/100/6/0.2/1/0.5.0 generic SCSI
/0/100/6/0.2/1/0.6.0 generic SCSI
/0/100/6/0.2/1/0.8.0 generic SCSI
/0/100/6/0.2/1/0.9.0 generic SCSI
/0/100/6/0.2/1/0.a.0 generic SCSI
/0/100/6/0.2/1/0.b.0 generic SCSI
/0/100/6/0.2/1/0.7.0 generic SCSI
/0/100/6/0.2/1/0.c.0 generic SCSI
/0/100/1d bus 82801EB/ER (ICH5/ICH5R) USB UHCI Con
/0/100/1d.1 bus 82801EB/ER (ICH5/ICH5R) USB UHCI Con
/0/100/1d.2 bus 82801EB/ER (ICH5/ICH5R) USB UHCI Con
/0/100/1d.3 bus 82801EB/ER (ICH5/ICH5R) USB UHCI Con
/0/100/1d.7 bus 82801EB/ER (ICH5/ICH5R) USB2 EHCI Co
/0/100/1e bridge 82801 PCI Bridge
/0/100/1e/3 display Rage XL
/0/100/1e/4 system Integrated Lights Out Controller
/0/100/1e/4.2 system Integrated Lights Out Processor
/0/100/1f bridge 82801EB/ER (ICH5/ICH5R) LPC Interfac
/0/100/1f.1 storage 82801EB/ER (ICH5/ICH5R) IDE Controll
This is sample output - yours may be different.
Invoked from within a shell script, this will print the directory in which the script resides. Doesn't depend on external tools, /proc/self/*, etc.. (`echo` is a shell builtin.) To see the *current working* directory of a script, use `pwd`.
mailutil appenddelete '{src.mailsrv1.com:993/imap/norsh/notls/ssl/novalidate-cert/user="username"}INBOX' '{dest.mailsrv2.com:143/imap/norsh/notls/user="username"}INBOX'
This is sample output - yours may be different.
This one-liner was useful in helping someone I know to get off of MS Exchange. `mailutil` proved to be a much better alternative than `fetchmail` or `getmail` in this case.
It quickly moved all mails to the destination server (a simple Dovecot/Maildir setup), with no need to convert back and forth between mbox/maildir on the user's own system.
for i in ~/.adobe ~/.macromedia ; do ( rm $i/ -rf ; ln -s /dev/null $i ) ; done
This is sample output - yours may be different.
$ ll .macromedia .adobe
lrwxrwxrwx 1 abc abc 9 Dec 29 21:07 .macromedia -> /dev/null
lrwxrwxrwx 1 abc abc 9 Dec 29 21:07 .adobe -> /dev/null
Brute force way to block all LSO cookies on a Linux system with the non-free Flash browser plugin. Works just fine for my needs. Enjoy.