e.g.
Code: Select all
# which scalc
/usr/local/bin/
Code: Select all
# which scalc
/usr/local/bin/
It is there in my copy of 1.0.7~newbie wrote:why was "which" command remove in 1.0.7?
Code: Select all
21:55:07 root@jm:~# which echo
/bin/echo
21:55:09 root@jm:~# type -a echo
echo is a shell builtin
echo is /bin/echo
21:55:13 root@jm:~#
Code: Select all
21:55:13 root@jm:~# help type
type: type [-afptP] name [name ...]
For each NAME, indicate how it would be interpreted if used as a
command name.
If the -t option is used, `type' outputs a single word which is one of
`alias', `keyword', `function', `builtin', `file' or `', if NAME is an
alias, shell reserved word, shell function, shell builtin, disk file,
or unfound, respectively.
If the -p flag is used, `type' either returns the name of the disk
file that would be executed, or nothing if `type -t NAME' would not
return `file'.
If the -a flag is used, `type' displays all of the places that contain
an executable named `file'. This includes aliases, builtins, and
functions, if and only if the -p flag is not also used.
The -f flag suppresses shell function lookup.
The -P flag forces a PATH search for each NAME, even if it is an alias,
builtin, or function, and returns the name of the disk file that would
be executed.
This finds stuff anywhere, in your $PATH or otherwise, by scanning the entire filesystem, computing the size of every file, and then discarding the output for all lines not matching your string. It works, but is inefficient (slow on systems with large amounts of files).kethd wrote:I often find things this way:
# du -a / | grep sysinit
Being new to the command line, I am just learning, but this is a very powerful and useful way to look everywhere for something.
Code: Select all
# find / -name "*sysinit*"
I suggest that it is more appropriate to use the relevant options to your search tool(s). For example: grep has a -i option for case-insensitive string matching, find has a -iname option for case-insensitive filename matching. So, you might tryBut you have to remember that Linux is case sensitive. So if you are looking for stuff related to Gdmap, you might be safer trying
# du -a / | grep dmap
Code: Select all
# du -a / |grep -i gdmap
Code: Select all
# find / -type f -iname "*gdmap*"
So make yourself an alias or shell function in your ~/.bashrc file, and copy that file to every machine you have shell access to. Over time, your .bashrc will change grow to meet your own changing needs.kethd wrote:But if I am on a fast RAM/CF-IDE system and it only takes 3 seconds total, it is much more efficient than typing a longer command, of my time.
Sad but true. Just like learning to spell in English, really! Yet may people consider learning to spell a useful subset of English words worth doing, if they expect to do a fair bit of writing in English during their lifetime. Similarly, may I suggest that learning a useful subset of Unix commands and switches is also worth doing, if you expect to spend a fair bit of time using Unix (or Unix-like shells) in your lifetime!On a more practical level, it takes a long time to get comfortable with all the switches for all the commands. There seems little rhyme or reason to them.
That option seems to me to make du close to useless... why not just use ls, if all you need is a list of what is in one directory and how big each item is??And, for example, the du option I most want, --max-depth=1, seems to have no standard usable practical shortform!
Your own package, because it is tailored to only including the things *you* need My own .bashrc works fine on a wide variety of machines, from RedHat to SuSe to Fedora to Puppy to DSL to FreeBSD to NetBSD to even SCO and Novell commercial Unices, and SGI Irix (though it's been a while, I might have accidentally broken compatibility with some or all of the commercial ones by now!). I strongly suggest that you do *not* use someone else's package of shell customizations. It won't be what you need, and you won't learn from the process of creating it. By all means read one or two, and make notes of the kinds of things they offer, and if you see useful shell coding ideas you like, "borrow" those ideas. But don't just use such a package.(Yes, I know there are all kinds of ways I can "customize" the command line. But I don't want to get addicted to me own weird ways of doing things, and not be comfortable with the generic default standard. Any recommendations on the best, most "standard" packages of shortcuts/aliases/macros etc for making the command line more efficient?)
That's a peculiar perception, really. You have access to so much power and so many capabilities at the shell prompt, it is almost overwhelming. For example, here's what happens when I hit the TAB key twice in bash on my FC4 PC (nothing special, a couple of years old generic P4 box)The first thing that bit me getting used to the Linux command line was the shock of discovering how much was being hidden from me. Because of the leading period and because of the case-sensitivity.
Code: Select all
01:08:50 jonathan@jm:~$
Display all 3432 possibilities? (y or n)
01:08:50 jonathan@jm:~$
That would beSo as a newbie I have grabbed the life preserver of the one most powerful command I could find that would really show me Everything...
Code: Select all
# find /
Because, as far as I know, ls won't show me the size of directories -- which is the main thing I want."And, for example, the du option I most want, --max-depth=1, seems to have no standard usable practical shortform!"
That option seems to me to make du close to useless... why not just use ls, if all you need is a list of what is in one directory and how big each item is??
jmarsden wrote:... why not just use ls, if all you need is a list of what is in one directory and how big each item is??
I use:kethd wrote:Because, as far as I know, ls won't show me the size of directories -- which is the main thing I want. ... If I can just get a complete summary at the top-current level ...
Code: Select all
# du -sm *
I'm not sure about tree format, but something likekethd wrote:(Is there a light-weight text-only tool similar to Xdiskusage, that will fit all the most important info about the largest files/folders on one screen, in some sort of tree format?)
Code: Select all
# du -a . |sort -nr |head
Code: Select all
# du -as * |sort -nr |head
(a) If you can truly run Bash after a sysinit failure, you have an unusual setup -- tell me more! (b) Are you saying that you need a tool to look at disk space usage on an unconfigured LiveCD??? Surely in that context, you would already know what you put into the .iso before you even burned the CD? You have the tree of files from which you built the ISO sitting on your development box... use du over there, not on the test box you just booted the newly developed LiveCD on! (c) On any machine that has an Internet connection and ssh, a quickSince my work right now is focused on systems like bare unconfigured LiveCDs (and troubleshooting failed sysinits) I am a ways from being able to have any personal mods always available from the command line.
Code: Select all
# scp -p me@mybox.mydomain.com:.bashrc .
That's by design. Why would you want to suddenly switch away from typing to some other mode of data entry? Keep your hands on the keyboard, stay focused... it's very productive once you are used to it. Also, it works on a huge variety of Unix-like machines all over the world.I tried using the fancy TAB bash CL features on Puppy, but was unimpressed. On the filename completion, it seemed weird that it would give me the choices, but there seemed to be no way to just pick one -- I just had to keep typing the filename until I reached uniqueness.
Yes. Bash is bash is bash. At least for me, command completion in bash under Puppy 1.0.7 "just works". Can you provide an example that fails for you in Puppy 1.0.7? Did you read the relevant sections of the Bash Reference Manual to check that what you expect by way of TAB capabilities is what Bash does out of the box? Which other shells that have TAB-based completion facilities are you comparing Bash to?And none of the other TAB features seemed to work in Puppy. Maybe I made a wrong turn somewhere -- is TAB access to commands etc in Puppy?
i think you would like my Xdu package ... it is a gui tool like xdiskuseage, and is exactly like xdiskuseage because it is the program that xdiskuseage was based onIs there a light-weight text-only tool similar to Xdiskusage