Jump to content

* * * * - 4 votes

Shell tricks

  • Please log in to reply
83 replies to this topic

#81 R3DPiLL


    Will I break 10 posts?

  • Members
  • 2 posts
  • Gender:Male

Posted 06 December 2010 - 02:02 PM

whereis firefox

Really nice one! I still consider myself a noob, and I'm not yet entirely confident with the folder structure. I anticipate that this command will help me a lot. A web search tells me that the command
does roughly the same thing.

#82 bitweiler


    the 0ne

  • Members
  • 1 posts
  • Gender:Male
  • Country:
  • Location:Saint Louis, Missouri

Posted 19 January 2011 - 10:10 PM

Okay I don't know if this was posted already but to me it's really handy sometimes.
rm'ing files of a certain size in a directory of my choosing all in one go.

find ~/build/ -type f -size 0 -exec rm {} \+

#83 D9u


    the 0ne

  • Members
  • 1 posts
  • Gender:Male
  • Country:
  • Location:Earth

Posted 29 June 2011 - 02:49 AM

Record a desktop session, with audio.

cd $HOME/recordings
SavePath=$(zenity --file-selection --save --confirm-overwrite)
echo "Saving video to $SavePath"

INFO=$(xwininfo -frame)

WIN_GEO=$(echo "$INFO"|grep -e "Height:" -e "Width:"|cut -d\: -f2|tr "\n" " "|awk '{print $1 "x" $2}')
WIN_POS=$(echo "$INFO"|grep "upper-left"|head -n 2|cut -d\: -f2|tr "\n" " "|awk '{print $1 "," $2}')

ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $WIN_GEO -r 15 -i :0.0+$WIN_POS -r 15 -acodec pcm_s16le -sameq "$SavePath.avi"

echo "$WIN_GEO -i :0.0+$WIN_POS -acodec"
echo "$WIN_POS"

The script expects a directory named "recordings" under ~/

#84 dinscurge


    "I Hack, therefore, I am"

  • Members
  • 977 posts
  • Gender:Male
  • Country:
  • Location:the bunker

Posted 23 November 2011 - 11:54 PM

dd if=/dev/zero of=location+filename size=blocksize count=number of blocks desired
simple yes but has some uses :p. like if you want to install linux in one partition without setting up logical partitions if say a oem installation on a laptop can wipe out recovery partition which is usually big enough for linux, use the above and
mkswap -filelocation/name-
or you can make your own vaults/encrypted volumes by formating the file like
mkfs.ext4 -filename/location-
mount -o -t ext4 -file location/name- -mount dir-
can use gpg or whatever you prefer to encrypt said file, can do multiple times over if you want. could use the same ddfile/image for anything that needs a partition or where a partition could add security like having all your web content for a web server in said partition and only give the webserver privileges to that image. it will also indicate the speed of your hdd/sdd/ram wherever your writing the file as if=/dev/zero has dd actually write all the bytes to 0

BinRev is hosted by the great people at Lunarpages!