LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 09-27-2002, 01:28 PM   #46
lackluster
Member
 
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Rep: Reputation: 30

here's one i recenly found :

tab completion {BASH} :
if you have a long file name that you don't wanna type you can type a few letters then tab. * works dometimes too.
 
Old 10-02-2002, 06:17 AM   #47
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Original Poster
Rep: Reputation: 56
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

superduperdocumentaboutbossfamily
superduperdocaboutbosscreditcards
superduperdocaboutbossschedule

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
 
Old 10-04-2002, 01:00 AM   #48
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Original Poster
Rep: Reputation: 56
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
 
Old 10-04-2002, 11:30 AM   #49
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Press Tab 2 or 3 times at a bash prompt and you will get a list of all available commands.

 
Old 10-04-2002, 11:41 AM   #50
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Original Poster
Rep: Reputation: 56
more on more

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.
 
Old 10-05-2002, 01:51 AM   #51
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Dude! That one is sweet, well I guess it's time to learn more vi... Damn vi! Why can't it be more like pico, all user friendly and crap

Just kidding, really. That's an awesome trick, thanks!

Cool
 
Old 10-09-2002, 06:57 PM   #52
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Original Poster
Rep: Reputation: 56
Suspend root

Another trick that I've forgotten about but kind ppl over UGU have refreshed my memory on:
Quote:
SUSPEND YOURSELF

Do you hate always having to type: /bin/su root
Do you wish you only had to do it once?

Well, here is a way to "suspend" root and bring it back.

Use the "suspend" and "fg" commands to switch
from root to login ID, and back to root:

foo 15% /bin/su
Password:
foo 1#
foo 2# suspend
stopped
foo 16% fg
/bin/su
foo 3#

And that's it.....

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.
 
Old 10-12-2002, 01:27 AM   #53
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Original Poster
Rep: Reputation: 56
NULL it fast

Here's one more tip
Quote:
NULL IT FAST

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...

This tip generously supported by: ulli@ucrc.org
 
Old 11-17-2002, 07:38 PM   #54
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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.
 
Old 01-22-2003, 12:45 AM   #55
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Quote:
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?

Thanks again
 
Old 01-22-2003, 08:29 PM   #56
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Original Poster
Rep: Reputation: 56
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.
 
Old 01-22-2003, 08:53 PM   #57
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Sorry Boris, but it's a no go... I just tried as root too just to make sure it's not some odd permissions thing.

Hmmm, I'll see what I can find.

Thanks for the suggestion though
 
Old 01-22-2003, 09:50 PM   #58
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Wow, what a cool thread. Thanks to whoever dug this one up...

Anyway, my little trick: All the gurus will know this one but it might be useful for the n00bs. In your .bashrc add:
Code:
alias ll='ls -l' # list long
alias la='ls -a' # list all
and you don't have to type those annoying flags to get different list results. Of course you can do this with any command you fancy.
 
Old 01-22-2003, 11:43 PM   #59
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
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)
 
Old 01-23-2003, 01:14 AM   #60
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
why not just this:

make dep ; make clean ; make bzImage ; make modules ; make modules_install

and sorry MC we can't make fun of those guys and their euro until we stop measuring the trip to the bank in miles
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wargame Hints? the_p0et Linux - Security 3 10-19-2003 11:04 PM
hints and tips bigjohn LQ Suggestions & Feedback 0 08-04-2003 01:48 PM
Slackware CUPS hints mi6 Slackware 3 06-05-2003 08:56 PM
Hints - process myquestion Programming 2 04-15-2002 07:26 PM
gcad hints ? jamaso Linux - General 0 03-02-2002 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration