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.
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.
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:
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.
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".
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
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.
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602
Rep:
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.
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.