LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-14-2003, 04:18 AM   #76
boreo
Member
 
Registered: Feb 2003
Location: Dominican Republic
Distribution: Slackware, FreeBSD, RedHat
Posts: 326

Rep: Reputation: 30

I just read the 5 pages!!! This thread rocks!!!!.. P.S I just made a little book about all the tricks for my personal use lol
 
Old 06-14-2003, 07:39 AM   #77
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Sometimes you come across a file you need several consecutive lines of. Shame the part you want doesn't start at line 1 or doesn't end at the last line. Adding this function to your functionlib or ~/.bashrc
Code:
function getLines() { # Get lines from file
arg=( $@ )
if [ "${#arg[@]}" != "3" -o ! -f "${arg[0]}" ]; then
printf "%sgetLines: <file> <from> <to>\n"; else
str=( $(wc -l ${arg[0]}) ); str="${str[0]}"
arg[1]=$(expr ${str} - ${arg[1]})
arg[2]=$(expr ${str} - ${arg[2]})
echo \$-${arg[1]},\$-${arg[2]} p | ed -s ${arg[0]}
fi; unset str; }
now you can "getLines: <file> <first line> <last line>".
Note the "core" is just a simple "ed" line.
 
Old 06-14-2003, 11:02 PM   #78
Brain Drop
Member
 
Registered: Feb 2003
Location: just outside reality
Distribution: balanced
Posts: 752

Rep: Reputation: 35
what a groovy thread!!

when i read about bash commands it often doesnt sink in but here with the examples some of you gave it made more sense.

like i think i never really paid attention to alias before, seems pretty powerful to me now.

to make sure i got it right: you can type in .bashrc like this:

alias cdnow='cdrecord -v -audio -pad speed=<burning speed> dev=<your device>'

and then when its time type:

cdnow /path/to/*.wav

yes?
 
Old 06-14-2003, 11:26 PM   #79
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
yup! pretty cool huh? There is a thread around here somewhere where people posted the different aliases they used. Its pretty cool.

Okay I just went back and read all the pages. Pretty cool stuff. Anyway, I'm sure some of you already know this but I like to use subshells sometimes. If I'm in some crazy directory like /usr/java/j2sdk/plugins/i386/blah/blah and I want to go somewhere else and do something without having to cd back to this directory I can do it in a subshell like this:

[user@localhost ns610]$ pwd
/usr/java/j2sdk1.4.1_02/jre/plugin/i386/ns610
[user@localhost ns610]$ (cd /usr/lib/fakedirctory; ls)
Fake.txt Contents FakeFile.txt
[user@localhost ns610]$ pwd
/usr/java/j2sdk1.4.1_02/jre/plugin/i386/ns610

As you can see, because I enclosed the command in parenthesis it simply kicks me back to the original directory is was in.

Last edited by Crashed_Again; 06-14-2003 at 11:40 PM.
 
Old 06-15-2003, 05:08 PM   #80
Brain Drop
Member
 
Registered: Feb 2003
Location: just outside reality
Distribution: balanced
Posts: 752

Rep: Reputation: 35
not really a linux trick but id just like to point out the web browser startpage that somebody else here pointed out awhile ago( i cant remember who) where you use a local file with hyperlinked images of all your commonly visited web page logos. i started doing this myself and it sure makes life simpler. and although its a local file i still use the remote images so i always know if a link no longer works as soon as my browser starts.

Last edited by Brain Drop; 06-15-2003 at 05:11 PM.
 
Old 06-16-2003, 04:51 PM   #81
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Bash Keystroke Combinations

Alt+B -> Go back one word
Alt+F -> Go forth one word
Ctrl+K -> Delete everything from the cursor to the end of the line
Ctrl+U -> Delete everything from the cursor to the beginning of the line
Ctrl+Y -> Paste deleted characters at the current position
Ctrl+H -> Delete one character
Ctrl+L -> Clean screen
Ctrl+P -> Go to the previous history entry
Ctrl+N -> Go to the next history entry

Also you can use !word to re-execute the last command beginning with "word".

Using !word

$ gcc -o test test.c
$ !gcc
gcc -o test test.c
$
 
Old 06-21-2003, 12:18 AM   #82
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Run a screensaver as your background

For example, to run hopalong as your background, open an x terminal and command:
Code:
nohup /usr/X11R6/lib/xscreensaver/hopalong -root &
nohup = no hangup, i.e. lets process run after x terminal closes, the & returns the terminal for use with the process in the background.
 
Old 06-22-2003, 12:33 PM   #83
oneferna
Member
 
Registered: May 2003
Distribution: Fedora Core 3, Gentoo
Posts: 47

Rep: Reputation: 15
More aliases

I ssh everywhere so I like to make aliases for that, I have a million aliases in my .bash_profile

example

alias server1="ssh me@server1.com" (I can't figure out how to make LQ not think that's an email address...it's not tho)

so all I type on the command line is server1 and away I go.
 
Old 07-03-2003, 02:29 PM   #84
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
I am trying to gauge the interest in a tips and hints sub-forum. Is this something people would be interested in? Would you post in it?

--jeremy
 
Old 07-03-2003, 02:50 PM   #85
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Do I remember suggesing this when I first joined?

I would vote aye!
 
Old 07-03-2003, 05:18 PM   #86
andrewlkho
Member
 
Registered: Jul 2003
Location: London
Posts: 548

Rep: Reputation: 31
hmm....me thinks that a link to this thread in the newbie section might be a good idea. after all, these kind of tricks are exactly what a newbie wants when trying to get to know linux.
just my $0.02
andy
 
Old 07-03-2003, 05:25 PM   #87
slightcrazed
Member
 
Registered: May 2003
Location: Lisbon Falls, Maine
Distribution: RH 8.0, 9.0, FC2 - 4, Slack 9.0 - 10.2, Knoppix 3.4 - 4.0, LFS,
Posts: 789

Rep: Reputation: 30
I think it would be a great idea. More than just tips and hints, I would like to see something more comprehensive. Almost like a mini linuxquestions HOWTO forum.

slight
 
Old 07-03-2003, 09:51 PM   #88
tigerflag
Member
 
Registered: Aug 2002
Location: Phoenix, AZ
Distribution: PCLinuxOS 2012.08
Posts: 430

Rep: Reputation: 30
YES! YES!

(...jumps up and down, raising both hands to be counted twice)
 
Old 07-04-2003, 10:35 AM   #89
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
Quote:
Originally posted by slightcrazed
I think it would be a great idea. More than just tips and hints, I would like to see something more comprehensive. Almost like a mini linuxquestions HOWTO forum.

slight
The LinuxQuestions.org HOWTO section is almost completed.

--jeremy
 
Old 07-05-2003, 02:00 AM   #90
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
I haven't read the whole of this thread, so forgive me if this is redundant:
Code:
splitvt
Run two shells in a split window. One above the other. Very useful for programming. . . (Ctrl-W to switch between the two shells by default, can be changed--read the man page).
 
  


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 10:21 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