vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Here's a bash script that makes it easy to traverse your file system. #!/bin/bash #/usr/local/bin/browse.sh # script must be sourced opwd() { if [ -z $OLDPWD ] then echo OLDPWD_not_set else echo $OLDPWD fi } if [ "$1" ] ; then cd $1; fi while true do echo "present working directory is: $PWD" echo "Shift-Page Up/Down for large dirs" select dir in exit $(opwd) ../ $HOME / $(\ls -F | grep /) do if [ $REPLY = "1" ] then \ls -shF $PWD && return 0 else cd $dir fi break done done The output looks like this: present working directory is: /etc Shift-Page Up/Down for large dirs 1) exit 6) X11/ 11) cron.weekly/ 16) gtk-2.0/ 21) pango/ 26) skel/ 2) /root/music 7) chatscripts/ 12) default/ 17) logrotate.d/ 22) ppp/ 27) ssl/ 3) ../ 8) cron.daily/ 13) dhcpc/ 18) lvm/ 23) profile.d/ 28) udev/ 4) /root 9) cron.hourly/ 14) file/ 19) modprobe.d/ 24) radiusclient/ 29) xdg/ 5) / 10) cron.monthly/ 15) fonts/ 20) mutt/ 25) rc.d/ #? You enter a number and you are in the chosen directory in a blink, with a similar menu displayed for that directory. Unless the number you choose is "1", and then the script runs ls -shF on the current directory and exits. 1 is always exit, 2 is always the last directory you were at (if set), 3 is always the parent directory of the one you are in, 4 is always your home directory, and 5 is always /. The script needs to be sourced, which is to say it must be run like this: .. browse.sh or source browse.sh The best way to use the script is to alias it to "b", by putting this in your /etc/profile: alias b='. browse.sh' (Or, better yet, in your /etc/aliases file, with this in your /etc/profile: source /etc/aliases ) If you want that alias to work in any particular window before rebooting, then you'll have to do this: .. /etc/profile Copy the script into a file in /usr/local/bin and name it browse.sh and then do: chmod +rx browse.sh There is no faster filesystem browser in existence. It is faster than any file manager, in or out of KDE/Gnome. You can start the script with a particular destination directory, if you want, like: b /usr Tom |
| |||
| Tom Newton (tom@server.invalid) writes: > Here's a bash script that makes it easy to traverse your file system. > So you fire up lynx, and prety much have everything you need. None of that gui stuff needed, don't even need the menu based MC. You can easily move all over the file system with the cursor keys, and have basic file management and of course you can edit files. I used lynx as my only browser for five years, until I installed Linux at which point I suddenly could run a graphic browser for the first time. But hey, I still use lynx as my main browser, and only when I need to do I go to KDE and a graphic browser. But then, I don't have any animosity towards the guis. Michael |
| |||
| On 2008-02-04, Tom Newton <tom@server.invalid> wrote: > Here's a bash script that makes it easy to traverse your file system. That seems kinda bloated. What's wrong with cd and ls? cd and ls are part of my new desktop enviroment, NAPOSDEFADNK, which stands for Not A Piece Of Shit Desktop Environment From A Delusional Net Kook. Though the acronym is a bit bloated. [80+ lines of bloat snipped] --keith -- kkeller-usenet@wombat.san-francisco.ca.us (try just my userid to email me) AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt see X- headers for PGP signature information |
| |||
| I should have said that this file browser is faster than any other one around _if_ you are a computer-literate person who can touch type. If you are an ignorant and lazy couch potato-appliance operator who can't use both hands because the one not holding a mouse has food or drink in it to stuff your face with while you play vidoe games or watch movies, then it obviously won't be very fast for you at all. But I didn't write the script for people like you, so that doesn't matter, does it? Tom On 2008-02-04, Tom Newton <tom@server.invalid> wrote: > Here's a bash script that makes it easy to traverse your file system. > > > #!/bin/bash > > #/usr/local/bin/browse.sh > # script must be sourced > > opwd() > { > if [ -z $OLDPWD ] > then echo OLDPWD_not_set > else echo $OLDPWD > fi > } > > if [ "$1" ] ; then cd $1; fi > > while true > do > echo "present working directory is: $PWD" > echo "Shift-Page Up/Down for large dirs" > select dir in exit $(opwd) ../ $HOME / $(\ls -F | grep /) > do > if [ $REPLY = "1" ] > then \ls -shF $PWD && return 0 > else cd $dir > fi > break > done > done > > The output looks like this: > > present working directory is: /etc > Shift-Page Up/Down for large dirs > 1) exit 6) X11/ 11) cron.weekly/ 16) gtk-2.0/ 21) pango/ 26) skel/ > 2) /root/music 7) chatscripts/ 12) default/ 17) logrotate.d/ 22) ppp/ 27) ssl/ > 3) ../ 8) cron.daily/ 13) dhcpc/ 18) lvm/ 23) profile.d/ 28) udev/ > 4) /root 9) cron.hourly/ 14) file/ 19) modprobe.d/ 24) radiusclient/ 29) xdg/ > 5) / 10) cron.monthly/ 15) fonts/ 20) mutt/ 25) rc.d/ > #? > > You enter a number and you are in the chosen directory in a blink, with a similar menu displayed for > that directory. Unless the number you choose is "1", and then the script runs ls -shF on the current > directory and exits. > > 1 is always exit, 2 is always the last directory you were at (if > set), 3 is always the parent directory of the one you are in, 4 > is always your home directory, and 5 is always /. > > The script needs to be sourced, which is to say it must be run like this: > > . browse.sh > > or > > source browse.sh > > The best way to use the script is to alias it to "b", by putting this in your /etc/profile: > > alias b='. browse.sh' > > (Or, better yet, in your /etc/aliases file, with this in your /etc/profile: > source /etc/aliases > ) > > If you want that alias to work in any particular window before rebooting, then you'll have to > do this: > > . /etc/profile > > Copy the script into a file in /usr/local/bin and name it browse.sh and then do: > > chmod +rx browse.sh > > There is no faster filesystem browser in existence. It is faster than any file manager, in or > out of KDE/Gnome. > > You can start the script with a particular destination directory, if you want, like: > > b /usr > > Tom > > > > > |
| |||
| <modquote> On 2008-02-04, Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote: > On 2008-02-04, Tom Newton <tom@server.invalid> wrote: >> Here's a bash script that makes it easy to traverse your file system. > > That seems kinda bloated. What's wrong with cd and ls? cd and ls are > part of my new desktop enviroment, NAPOSDEFADNK, which stands for Not A > Piece Of Shit Desktop Environment From A Delusional Net Kook. Though > the acronym is a bit bloated. </modquote> Is that too long for a modquote? ;_) -RW |
| |||
| On Mon, 4 Feb 2008, Robby Workman wrote: > > <modquote> > On 2008-02-04, Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote: >> On 2008-02-04, Tom Newton <tom@server.invalid> wrote: >>> Here's a bash script that makes it easy to traverse your file system. >> >> That seems kinda bloated. What's wrong with cd and ls? cd and ls are >> part of my new desktop enviroment, NAPOSDEFADNK, which stands for Not A >> Piece Of Shit Desktop Environment From A Delusional Net Kook. Though >> the acronym is a bit bloated. > </modquote> > > Is that too long for a modquote? ;_) > > -RW hahahah I hope not -- Cheers Res mysql> update auth set Framed-IP-Address='127.0.0.127' where user= 'troll'; |
| ||||
| On Mon, 04 Feb 2008 05:36:45 +0000, Tom Newton wrote: > I should have said that this file browser is faster than any other one > around _if_ you are a computer-literate person who can touch type. > > If you are an ignorant and lazy couch potato-appliance operator who > can't use both hands because the one not holding a mouse has food or > drink in it to stuff your face with while you play vidoe games or watch > movies, then it obviously won't be very fast for you at all. > > But I didn't write the script for people like you, so that doesn't > matter, does it? > > Tom > > Yes, your tears are like sweet, sweet nectar Tom. |