find-fun

  • skullnotions
Posted: Sat, 07/26/2008 - 18:08
Take a break and have some fun in the terminal. $ = user # = root copy/paste this code into a terminal... better still type it youself .) $ find . -type f -exec ls -s {} \; | sort -n -r | head -50 | cat -n | tee ~/bigfile.list when it completes type: $ ls -l You should find a file bigfile.list You should see the 50 largest files in your home directory printed to the screen. Also a file has been created called bigfile.list in your home directory. $ edit bigfile.list Now you can delete your unwanted junk. Have fun, dave.

Easter-Eggs

  • skullnotions
  • 09/29/07
  • Mon, 01/12/2009 - 11:04
You can run these in a terminal as user: apt-get moo aptitude moo aptitude -v moo aptitude -v -v moo aptitude -v -v -v moo aptitude -v -v -v -v moo aptitude -v -v -v -v -v moo Cheers! dave

grep & find inside many files

  • skullnotions
  • 09/29/07
  • Sat, 01/10/2009 - 09:37
If you have a directory with many files inside and you want to search all the files. e.g. I keep a directory with all my bash_history backups then: cd (into your bash_history backups directory) and run: grep remove * grep mkdir * Or if there's lots of files in the directory run: find . -print0 | xargs -0 grep -H remove find . -print0 | xargs -0 grep -H mkdir Cheers! dave

bashrc grep history

  • skullnotions
  • 09/29/07
  • Fri, 01/09/2009 - 07:45
To help you search your bash_history, add the following to your .bashrc export HISTSIZE=1000000 HISTFILESIZE=1000000 At the bottom of the file in the alias section add: alias h="history|grep " now run: ". .bashrc" (to save you having to log out & back in to your desktop) Then you can search your bash_history with: h sudo h cp h gedit etc., Cheers! dave

Disk Usage 2

  • skullnotions
  • 09/29/07
  • Fri, 01/09/2009 - 07:01
Nice little bit of typing practice: Get an ordered list of subdirectory sizes $ du -sk ./* | sort -n | awk 'BEGIN{ pref[1]="K"; pref[2]="M"; pref[3]="G";} { total = total + $1; x = $1; y = 1; while( x > 1024 ) { x = (x + 1023)/1024; y++; } printf("%g%s\t%s\n",int(x*10)/10,pref[y],$2); } END { y = 1; while( total > 1024 ) { total = (total + 1023)/1024; y++; } printf("Total: %g%s\n",int(total*10)/10,pref[y]); }' or you could just copy/paste into a terminal ;-) From Here. Cheers, dave

find-Software

  • skullnotions
  • 09/29/07
  • Fri, 01/09/2009 - 07:26
To help find/remove unwanted software run: dpkg --get-selections > software1 and again dpkg --get-selections > software2 This will create 2 files in your home directory software1 software2 These list the software installed, leave software1 alone. sudo grep "cups" software2 sudo grep "blue" software2 sudo grep "bluetooth" software2 etc.,etc., only you know what is not needed. sudo apt-get remove --purge (not needed software) Watch very carefully for shared libs and others apt might try to remove. This method will also keep a .bash_history of the software you have removed. Once you have removed software re-run: dpkg --get-selections > software2 software1 (default_software) software2 (installed_software) cp .bash_history bh_find-software dpkg -l | grep "linux" dpkg -l | grep "64studio" dpkg -l | grep "alsa" dpkg -l | grep "sound" dpkg -l | grep "fun" Cheers, dave

ecasound

  • skullnotions
  • 09/29/07
  • Fri, 01/09/2009 - 07:05
http://www.eca.cx/ecasound/ sudo apt-get update sudo apt-cache search ecasound swh-plugins - Steve Harris's LADSPA plugins ecamegapedal - an audio effects pedal application ecasound - Multitrack-capable audio recorder and effect processor ecasound-el - emacs binding files for ecasound sound editing environment ecawave - graphical audio file editor libecasound-ruby1.8 - ruby binding files for ecasound libecasound2.2-dev - development files for ecasound libecasoundc2.2-dev - c binding files for ecasound (devel) libkvutils2.2-dev - kvutils library required for ecasound - development python-ecasound2.2 - python binding files for ecasound 2.2 sudo apt-cache show ecasound Version: 2.4.4-6 sudo apt-get install ecasound sudo dpkg -l | grep ecasound ii ecasound....................2.4.4-6.....Multitrack-capable audio recorder and effect ii python-ecasound2.2...2.4.4-6.....python binding files for ecasound 2.2 for emacs sudo apt-get install ecasound-el sudo dpkg -l | grep ecasound ii ecasound-el............2.4.4-6.....emacs binding files for ecasound sound editi Thanks porisija :-) now I have to get it all up and running. Cheers! dave.

history find history

  • skullnotions
  • 09/29/07
  • Fri, 01/09/2009 - 07:30
Hi Gabriel, I get quite a list. e.g. find -name "*.txt" find find /media/hpdx3/ -name "*.txt" find -name "*.wav" find /media/hpdx3/ -name "*.wav" history | grep find emacs find-fun.txt find /media/hpdx7/ -type f -exec ls -s {} \; | sort -n -r | head -50 | cat -n | tee /tmp/bigf.list find | grep ".mozilla" find /mnt/fd0/ -exec grep "grep" {} \; find . -type f -print | sort | uniq find . -type f -exec ls -s {} \; time find . -type f -print0 | xargs --null du -s | sort -n -r | head -50 | cat -n | tee ~/bigfile.list etc., $ cp .bash_history bash_history_backup $ grep "find" bash_history_backup $ grep "cp" bash_history_backup $ grep "emacs" bash_history_backup $ grep "ls" bash_history_backup $ grep "du" bash_history_backup Cheers! dave

command line recording

  • porisija
  • 09/29/07
  • Sat, 07/26/2008 - 20:48
64Studio doesn't include ecasound by default, but installing it from Debian repos is a doddle (so I won't go there..) Anyways. Ecasound is an alsa/jackd compatible multichannel recorder, which is controlled at the command line. It supports recording over a TCP/IP connection in its daemon mode. The syntax of the program quite complex, but here are some examples. See "man ecasound" and the html documentation in /usr/share/doc/ecasound for more elaborate examples. (copy) These first two commands do the exact same thing, conver somefile.wav to somefile.cdr (CDR is the CD-Audio track format). As no chains are specified, the default chain is created and used. 1. ecasound -i:somefile.wav -o:somefile.cdr 2. ecasound -i somefile.wav -o somefile.cdr (copy) To get a liiittle more complex, here's another example: (copy) ecasound -a:1,2 -i somefile.wav -a:1 -o somefile.cdr -a:2 -o somefile.mp3 (copy) A useful addition to the previous would be this: ecasound -a:1,2,3 -i somefile.wav -a:1 -o somefile.cdr -a:2 -o somefile.mp3 -a:3 -o alsahw,0 so you can listen to what the file is about. Of course, jackd is the name of the game: Use with JACK audio server 1. ecasound -i foo.wav -o jack_alsa 2. ecasound -i foo.wav -o jack Ecasound manages complex audio input setups by creating so called chains of input/output. So test it - you'll be amazed at how little resources a (reltime) command line audio recorder (as ecasound) uses. I mainly use ecasound for capturing icecast streams over the internet. Of course I must make note that the author of ecasound is Kai Vehmanen - Finnish, like me. Cheers!

history

  • gabrbedd
  • 06/29/08
  • Sat, 07/26/2008 - 19:43
Wow. I never saw the 'history' command before. That's pretty nice. ...but what's the purpose of doing 'history | grep find'?

first run results

  • skullnotions
  • 09/29/07
  • Fri, 01/09/2009 - 07:29
Very nice :-) $ time find . -type f -print0 | xargs --null du -s | sort -n -r | head -50 | cat -n | tee ~/bigfile.list real 0m0.179s user 0m0.049s sys 0m0.050s $ du -s * | sort -n > du-list $ du -s * | sort -n | tee ~/du-list2 $ history | grep find $ history | grep du Cheers, dave

Do it faster... (theme and variations)

  • gabrbedd
  • 06/29/08
  • Sat, 07/26/2008 - 18:33
Cool! However, it took 2 minutes on just my Download directory (11,790 files). Here's some variations on the theme (output is identical except for white space), and they run a lot faster: FASTEST (1 sec): $ time find . -type f -print0 | xargs --null du -s | sort -n -r | head -50 | cat -n | tee ~/bigfile.list (Note: on 176,268 files in my $HOME, it took 1 minute 20 sec) RUNNER-UP (2 sec): $ time find . -type f -print0 | xargs --null ls -s | sort -n -r | head -50 | cat -n | tee ~/bigfile.list Some explanation: xargs: It gathers up filenames and runs ls or du only once for every few hundred files (as many as it can fit on the command line). The -print0 and --null arguments are used to handle when file names have spaces in them. du: 'Disk Usage.' Learn this tool. When doing cleanup, I often will do: $ du -s * | sort -n At the bottom of the list are the largest files or directories. Peace, Gabriel