Live data from Hacker News

Top Unix Command Line Utilities

blog.coldflake.com

31–40 of 65 posts

Re: Top Unix Command Line Utilities

#33
post #12

Earlier quoted context omitted.

I think the only "secure" way to erase the contents of a hard drive is to repeatedly overwrite the disk surface with a mix of random/patterened data (like Darik's Boot & Nuke does). Also, for those wondering about the blocking of /dev/random , it will restrict the number of bits you can copy using dd , but this won't be apparent unless you attempt to copy more bits from the entropy pools than there are available for…

Secure erase depends on the technology of the drive and the prowess of your attacker. If you fear the NSA seizing your disks, consider the tradeoffs of explosive disposal. If you fear a technically-savvy reporter going through your trash bin, overwriting your disk three or four times with patterns will be fine. But it's probably faster to take a drill and make a couple of holes. Make sure you hit the platters. If you…

Anyone wiping disks in any of these ways in 2013 is doing it wrong.

Zeroize the keys. Then you don't need to worry about the disk.

If your data is something that would be a problem if the physical disks were stolen, don't store it on-disk unencrypted.

Re: Top Unix Command Line Utilities

#34

A more interesting set of commandline utilities to know - http://www.cyberciti.biz/open-source/best-terminal-applicati...

This list is definitely more interesting to me. I discovered a few of these already this year and have been using them a lot (mtr, pv, curl for inspecting headers) and several others that I know I'm going to start messing with immediately (siege, multitail).

Another VERY useful tool I didn't see on this list is iperf. From the Debian package description:

Iperf is a modern alternative for measuring TCP and UDP bandwidth performance, allowing the tuning of various parameters and characteristics.

Features:

* Measure bandwidth, packet loss, delay jitter

* Report MSS/MTU size and observed read sizes.

* Support for TCP window size via socket buffers.

* Multi-threaded. Client and server can have multiple simultaneous connections.

* Client can create UDP streams of specified bandwidth.

* Multicast and IPv6 capable.

* Options can be specified with K (kilo-) and M (mega-) suffices.

* Can run for specified time, rather than a set amount of data to transfer.

* Picks the best units for the size of data being reported.

* Server handles multiple connections.

* Print periodic, intermediate bandwidth, jitter, and loss reports at specified intervals.

* Server can be run as a daemon.

* Use representative streams to test out how link layer compression affects your achievable bandwidth.

I use iperf initially when I'm troubleshooting poor file server transfer speeds, for example. There's a pretty Java GUI too if you want that.

Re: Top Unix Command Line Utilities

#35
post #12

Earlier quoted context omitted.

I think the only "secure" way to erase the contents of a hard drive is to repeatedly overwrite the disk surface with a mix of random/patterened data (like Darik's Boot & Nuke does). Also, for those wondering about the blocking of /dev/random , it will restrict the number of bits you can copy using dd , but this won't be apparent unless you attempt to copy more bits from the entropy pools than there are available for…

Secure erase depends on the technology of the drive and the prowess of your attacker. If you fear the NSA seizing your disks, consider the tradeoffs of explosive disposal. If you fear a technically-savvy reporter going through your trash bin, overwriting your disk three or four times with patterns will be fine. But it's probably faster to take a drill and make a couple of holes. Make sure you hit the platters. If you…

The whole "overwrite xx times" is a myth. Overwriting it once with random data makes it completely unreadable. Overwriting it more than that is a complete waste of time.

http://computer-forensics.sans.org/blog/2009/01/15/overwriti...

http://www.howtogeek.com/115573/htg-explains-why-you-only-ha...

Re: Top Unix Command Line Utilities

#36
post #15

"for i in *.mp3" doesn't work with spaces and some other "special" characters in filenames, see here: http://unix.stackexchange.com/questions/9496/looping-through...

The for loop works fine. Performing word splitting/wildcard expansion/etc on a variable will, well, split it into words/expand wildcards/etc, whether it was introduced by a for loop or not.

Re: Top Unix Command Line Utilities

#37
post #21

xxd is a pretty nice hexdump substitute that has a reverse mode of operation (-r), turning a hexdump into binary.

From what I recall xxd is actually part of the vim distribution, so it's common, but not everywhere. An approximate standard (coreutils) alternative is `od -x' (although it doesn't include the ASCII readable char column at the right, which can be annoying)

Re: Top Unix Command Line Utilities

#38
post #36
post #15

"for i in *.mp3" doesn't work with spaces and some other "special" characters in filenames, see here: http://unix.stackexchange.com/questions/9496/looping-through...

The for loop works fine. Performing word splitting/wildcard expansion/etc on a variable will, well, split it into words/expand wildcards/etc, whether it was introduced by a for loop or not.

I am not sure I understand what you mean. Word-splitting is performed by the "for x in y" construct, using the IFS variable, so by default if you have a file called "foo bar.mp4" the command line from the article:

  for i in *.mp4; do ffmpeg -i "$i" "${i%.mp4}.mp3"; done
will result in executing:

  ffmpeg -i foo foo.mp3
  ffmpeg -i bar.mp4 bar.mp3
Which is obviously not what was meant. So it's a good habit to learn to loop over files in a directory in a different way.

Re: Top Unix Command Line Utilities

#39
Not really a bash utility, but delegating to this script from vim has been a huge timesaver for long running scripts. For instance I can trigger my ruby specs from Vim without vim getting blocked. I wrote a blog post about it here: http://minhajuddin.com/2012/12/25/run-specs-tests-from-withi...

    #!/bin/bash
    #~/.scripts/runinbg
    #Author: Khaja Minhajuddin
    #Script to run a command in background redirecting the
    #STDERR and STDOUT to /tmp/runinbg.log in a background task

    echo "$(date +%Y-%m-%d:%H:%M:%S): started running $@" >> /tmp/runinbg.log
    cmd="$1"
    shift
    $cmd "$@" 1>> /tmp/runinbg.log 2>&1 &
    #comment out the above line and use the line below to get get a notification
    #when the test is complete
    #($cmd "$@" 1>> /tmp/runinbg.log 2>&1; notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$rawcmd")&>/dev/null &

Re: Top Unix Command Line Utilities

#40
post #26

Earlier quoted context omitted.

I am not familiar with awk, what's the 's+= $7'? What is the argument 2 passed to wc? Why is the produced output different? What am I missing here?

s += $7 means "add the content of the 7th column to the total"

Makes sense, thanks!
Post reply on HN