Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Tab completion is good, I wasn't aware of this up untill Spring 1999, really, I had no clue there was such a thing. In csh/tcsh you can use Esc key twice to simulate the same effect though, on most UNIX's you don't have that beauty that Linux user-friendlyness offers like when you press a tab key you have a list what's avalalble, guess what zsh went further, you can write your own functions for completion, and when you press for instance
ssh [TAB]
it will give you the list of recent hosts you've connected to and it will give you all the available command line switches for ssh command , beautiful? Bash development didn't sleep all that time, and now you can have the same behavior with bash check out http://www.caliban.org/bash/index.shtml#completion
and A couple of oldies from me:
!$ - holds the last command line argument, example
ls -d superduperdirectory*
superduperdirectory1 superduperdirectory2 superduperdirectory.3
mkdir superduperdirectory43
cd !$
and you are in superduperdirectory43
Another tip: argument sugsitiution, for instance your boss told you to print 5 documents to his printer and he'd call you when to print the next document, you know he/she wants to look throught them to verify some data in reality he/she just want to show you who's the boss
the docs names are reather long but they have a common part
so you are in command line
and you could just issue one command
lp -dsuperduperprinter superdup*
and be happy, but instead your boss was anal enough to ask you delay every doc, here's the solution, it might be not that preaty but it saves typeing command parts espacially when you are at CLI w/o gpm running (no easy copy/paste) lp -dsuperduperprinter superduperdocumentaboutbossfamily
boss calls for the next doc ^umentaboutbossfamily^aboutbosscreditcards
boss gets his next report, three minutes later he shouts to print the third cocument ^creditcards^schedule
So as you see whatever placed between ^ (carot symbol) is replaced by whatever follows.
Good day everyone, it is time to go to work
Here is another one, have you ever been stumpped by a corrupted tarred backup and you are so desperately needing this particular file from this particular backup?
EXTRACT CORRUPTED TAR FILE
In many case if there is a corrupted tar file,
the following command can be used in an attempt
to extract the file:
% cat [tar-filename] | tar -xvf -
NOTE: Where "-" is the STDOUT
It might work with tar.gz as well just include z flag in the tar command.
This tip generously provided by http://www.ugu.com
We're all more/less familiar with pagers like more and less Some prefer view the files with
more filename
less filename
What if you saw something you want to change while paging trough the file?
Some might think:"Oh, well, I'll quit more and edit the file with text editor..."
But there is a way to invoke vi from within more/less pager, just view the file with more/less as you normaly would do, and when you decide to change something press v to go into "vi mode". Edit, save, quit vi and you back in more/less.
Set and alias in root's .cshrc or .profile to shorten
the word "suspend" if that is too much to type.
alias sus 'suspend'
Generally, it is no good to have root shell hanging in the air while you're concetrating on your own account, but I myself use it all the time while oing system maintenance.
Here is the fastest way to truncate a file to zero
bytes in a bourne or korn shell.
$ > /var/log/messages
This is a good method, if the file has to be truncated,
but is opened by another process. For example, if you
want to truncate /var/log/messages, which is held
open by syslogd...
Here's another one: if you aliases a lot you can use Bash' "unalias" builtin or you can precede the command with a backslash. Stupid example: if you have something like "alias ps='ps ax -eo user,pid,priority,args'", then use \ps will do the trick.
Originally posted by neo77777 Here is another one, ever wonder what takes so much space on you precious *NIX box run this
find $1 -type d | xargs du -sm | sort -g
from the directory in question and the most hungry chunk will show up last.
I'm trying like mad to free up some space on my drive, and I happen to remember you posting this from this thread However, I get an error:
Code:
masterc@masterc:/home$ find $1 -type d | xargs du -sm | sort -g
xargs: unmatched single quote
And that's it. I am not sure why, but I've got a sneaking suspicion it's something to do with xargs Anyway, can someone enlighten me? Thank you! Also, I would like for this to go into all subdirectories if that's possible?
I am not sure why it isn't working for you it does the trick for me, and it does go further into subdirectories, try to encase du -sm into quotes it might be it, but again it works fine for me on my slack install.
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
Quote:
Originally posted by Goatdemon isn't (make; make install) the same as doing (make && make install) ?
No.
Code:
make ; make install
executes make install regardless of the exit status of make. So, if
make failed (non zero exit status), make install would still be
executed. bad.
Code:
make && make install
&& can be thought of as an "AND" operator (well, it IS an AND
operator), so the first has to be true for the second to be
executed, make needs to have an exit status of 0.
Code:
make || ./configure
will execute ./configure if and only if make exits with a non zero
status (fails). This is the logical OR operator.
(man bash, and you'll get this information, it's probably also in
all the other shells' man pages)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.