Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-02-2004, 06:25 PM   #1
Registered: Jan 2004
Location: USA, Pa
Distribution: Slackware 10
Posts: 65

Rep: Reputation: 15
Console: Hints and Tips

I'm making this post for anyone who wishes to tell the linux community a cool shortcut or tip that will make any newbie's life easier in the console. I'll start off with one I just learned.

Within any directory, if you type a little bit of the file name and press <tab> the console will automatcially fill in the rest of the file so you dont so happen to have a typo.

if you want to uncompress the file MPlayer-0.92.tar.bz2. All you would have to type is:
MPla<tab> and the console will print out "MPlayer-0.92.tar.bz2"

<tab> = press the tab key
Old 02-02-2004, 06:48 PM   #2
Senior Member
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 404Reputation: 404Reputation: 404Reputation: 404Reputation: 404
the 'history' command can also be your friend in the console
history keeps track of your last 1000 some commands and allows you to access them by at least 2 means
1 is 'history | less' (history pipe less), look at the number in front of the desired command then type in !XXX (XXX being the number)
the other simply being the up and down arrow keys to scroll through the most recent commands as with some web browsers
Old 02-03-2004, 12:14 AM   #3
Registered: Aug 2003
Location: Chapel Hill, NC
Distribution: Gentoo, Windows 95 2000 & XP
Posts: 160

Rep: Reputation: 30
if you want to get right to the last directory you were in type:

cd -

There are hundreds of unbelievable tips here:
LQ Tips and Tricks

It'll take a while to go through it, but it's definitely worth it. I'm still trying to summarize all of them, and organize them. Then I can throw it together for a little reference. So many useful features built into the bash shell, too little time to learn and use them all!!!
Old 02-03-2004, 12:22 AM   #4
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
'Screen' rocks.

Read the bash man page (if that's your shell) constantly.

Readline and history and the editing commands are huge, as frieza mentions. (Though the default histsize is 500 putting -
export HISTFILESIZE=1000
export HISTIGNORE=\&
export HISTSIZE=1000
- in your configs is useful.

Spend time on your ~/.bash_profile or however you configure your shell.

The man page will tell you about shopts and your configuration can set them up. In my ~/.bash_profile, I have 'shopt -s checkwinsize cmdhist extglob histappend histverify' and maybe should add 'cdspell' and others.

One of the coolest things there is is the semi-colon. The command line is not just for 'ls'. As a trivial example, I was in ~/.icons in aterm looking to add a calculator icon to Ice's little systray thing. So I typed
for f in `find -name *[Cc]alc*`; do xzgv $f; done
and got a slideshow of all my calculator icons, regardless of what subdir they were in. The command line kicks whether in console or a GUI.

You can get a bang out of bangs. '!cat' will re-execute your last cat command (and !wh will execute your last wh-atever command) or, with 'histverify' on, will load the command and you can choose to enter or edit it.

The Linux console/bash is just a blast.
Old 02-03-2004, 01:12 AM   #5
Senior Member
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
also to add to teh <tab> thingy, the star will also will in the last of the file name * , only it wont show up, it can also be used to select fiels of the same start, rm -fvr lilo* deleted everyhting beigning with lilo,

i dono if this makes it easyer but in ur bash profile the PS1 variable is used to customize the bash promt,
Old 02-03-2004, 08:50 AM   #6
Senior Member
Registered: Sep 2003
Location: UK
Distribution: Debian
Posts: 1,215
Blog Entries: 2

Rep: Reputation: 49
the 'history' command can also be your friend in the console
One good use of it is to do 'ctrl-r'; this starts an incremental backward search through the history list. For examply typing shu will probably be enough to get 'shutdown -r now'; doing ctrl-r again will probably get you 'shutdown -h now'. Personally use this all the time.


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
AcidRip - Detailed Hints and Tips - DVD Quality Backups/Copies AceTech747 Linux - Software 10 05-16-2005 09:34 AM
Wargame Hints? the_p0et Linux - Security 3 10-20-2003 12:04 AM
hints and tips bigjohn LQ Suggestions & Feedback 0 08-04-2003 02:48 PM
Quickie Tips, Hints, Shortcuts, etc dsledge Linux - Networking 0 04-02-2003 10:52 PM
Hints - process myquestion Programming 2 04-15-2002 08:26 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:09 PM.

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