LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 07-05-2003, 10:00 AM   #91
Cyclo
Member
 
Registered: Jul 2003
Distribution: Slackware 9.1
Posts: 47

Rep: Reputation: 15

Great feature of vim (heard there's something simliar in emacs) is folding, if you're a programmer.

You can collapse and expand sections of code you specify, handy if you have a function thats 300 lines long or something
works like this:
first, turn it on by typing ":set fdm=marker", then surround the bit you want to hide with:

//{{{ brief description here
whatever you want to hide
//}}}

also works with:
/*{{{ brief descriptinon */
whatever
/*}}}*/

to hide or close a section, type "zo" to open, "zc" to close
 
Old 07-07-2003, 03:21 AM   #92
Azmeen
Senior Member
 
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307

Rep: Reputation: 47
Lightbulb When tail is just not enough

An often forgotten but useful command when it comes to log viewing is tac...

Basically it's cat in reverse...

Example:
Code:
tac /var/logs/messages | less
Is this contribution cool enuff?
 
Old 07-07-2003, 05:04 AM   #93
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally posted by bulliver
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.
I don't want to throttle your zest ... But: at least in SuSE 8.1 this is a built-in feature, including color-coding. There is some use for newbie-friendly distributions after all ...
 
Old 07-08-2003, 05:32 PM   #94
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Vi or Vim as outliner

Originally posted by Cyclo
Great feature of vim (..)

...and for using Vi as outliner also see http://www.vim.org/scripts/script.php?script_id=517 and http://www.troubleshooters.com/linux/olvim.htm
 
Old 07-08-2003, 05:36 PM   #95
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Renice running script

Renice running script from inside.
Call as "reniceSelf <(+|-)value>".
Defaults to +15 if no value given.

function reniceSelf () { # Renice running script
n="$1"; renice "${n:=+15}" -p $$ >/dev/null 2>&1; unset n; }
 
Old 07-08-2003, 05:56 PM   #96
Allen614
Member
 
Registered: Dec 2002
Location: Plains
Distribution: Slackware 13
Posts: 465

Rep: Reputation: 30
This is a simple script using expect that opens any file manager in su mode ala KDE's version.

#!/usr/bin/expect

spawn "su"
expect -re "Password:"
send "rootpassword\r"
expect -re "#"
send "nohup program\r"
expect -re "#"
wait
 
Old 07-09-2003, 11:17 AM   #97
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
Quote:
Originally posted by Allen614
This is a simple script using expect that opens any file manager in su mode ala KDE's version.

#!/usr/bin/expect

spawn "su"
expect -re "Password:"
send "rootpassword\r"
expect -re "#"
send "nohup program\r"
expect -re "#"
wait
Wouldn't that leave your root password out in the open tho?
 
Old 07-09-2003, 05:24 PM   #98
Allen614
Member
 
Registered: Dec 2002
Location: Plains
Distribution: Slackware 13
Posts: 465

Rep: Reputation: 30
It would. You could rewrite it to prompt for the password if it's a concern.
 
Old 07-09-2003, 05:27 PM   #99
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
It would. You could rewrite it to prompt for the password if it's a concern.
Since it's the *root* password *and* in cleartext, I'd say that classifies it as a major concern right away.
 
Old 07-10-2003, 07:39 AM   #100
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Customize boot behaviour OTF

Here's an example showing how you can control what to load from the LILO bootprompt.
Now having a bootprompt commandline like
boot: linux loadusb disableswap lockgcc
*could* ./make sense.
 
Old 07-19-2003, 04:05 AM   #101
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Re: When tail is just not enough

Quote:
Originally posted by Azmeen
An often forgotten but useful command when it comes to log viewing is tac...

Basically it's cat in reverse...

Example:
Code:
tac /var/logs/messages | less
Is this contribution cool enuff?
Excellent tip! I've always wished something like this was available! I've often used tail but it quite more oftenly was not enough, I wanted more than 8 lines.

Cool
 
Old 07-19-2003, 04:17 AM   #102
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
tail -20 foo.log

or however many lines you want. Or am I missing something?

But, true, that's still in order - tac is cool for giving you the last first.
 
Old 07-19-2003, 09:10 AM   #103
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Thanks I guess since I was using tail and wasn't pleased with it's default use, I should have read the manpage eh?

Cool
 
Old 07-19-2003, 06:52 PM   #104
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Well, there's just so many apps with so many man pages with so many switches it's hard to find them all. I've found about .000002 of the ones I want.
 
Old 07-20-2003, 07:54 AM   #105
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
RPM mgmnt: for rpm, show files, md5sums

Will display files and md5sums for an installed rpm package.
Save as "rpm-contentsof-file+md5" or any name you like and make executable.
Needs access to the rpm database so only runs as root.

The Bash script is in this thread.
 
  


Reply



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 11:57 PM.

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