quick way to get earlier commands?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers quick way to get earlier commands?
# 1  
Old 06-22-2011
quick way to get earlier commands?

I used to use a linux system that would allow me to bring up previously-used commands by typing the first (or more) letters of a previous command and then hitting the tab key. It was incredibly useful. Now I've switched to using a mac and it doesn't work. Is there an analog to this for macs? Thanks...
# 2  
Old 06-22-2011
try this in your .profile or .bashrc file
Code:
alias r='fc -e -'

Then
Code:
r m

reruns the most recent command starting with "m" (or more letters)
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 06-22-2011
Quote:
Originally Posted by ac2011
I used to use a linux system that would allow me to bring up previously-used commands by typing the first (or more) letters of a previous command and then hitting the tab key. It was incredibly useful. Now I've switched to using a mac and it doesn't work. Is there an analog to this for macs? Thanks...
That's called tab completion, and works for commands you didn't use before too.

OSX terminal did have tab completion last time I used it. It had BASH, the same shell many Linux varieties use. Are you running an alternative shell, or have you played with your ~/.bashrc files?
# 4  
Old 06-22-2011
CTRL+R is a good one too. It does a reverse-search of bash history. It may be possible whatever you're trying to tab-complete has >1 match. Hit TAB twice for a list.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Vi quick substitution commands

I have a script that has quite a lot of these types of entries: hello=$(who am i) good=$(blahblah) what i want to do is replace the $( and the ) with `` so that they look like this: hello=`who am i` good=`blahblah` I tried this: :%s~=$(&&)$~=`&&`$~g (3 Replies)
Discussion started by: SkySmart
3 Replies

2. UNIX for Dummies Questions & Answers

find the no of processes that ran 2 hours before or earlier

Is there a way to find out the total no of processes that were running ? - 2 or 3 hours before - list those no of processes (3 Replies)
Discussion started by: jansat
3 Replies

3. Shell Programming and Scripting

Script that will show output starting from 24-hours earlier to present

Hi Guys, Good day! I hope you could help me on this, I have a file that conatins output upon executing cat /var/log/messages, then what I want is to get the logs that has been generated only starting from 24-hours earlier at the time of actual execution of the script. Is this possible? Best... (9 Replies)
Discussion started by: rymnd_12345
9 Replies

4. UNIX for Advanced & Expert Users

grep -v *[^:] Why did this repeat a command i ran earlier today?

I ran grep -v * trying to reverse grep a word before a colon, and discovered it runs a command I had run earlier today. Why? (3 Replies)
Discussion started by: glev2005
3 Replies

5. UNIX for Dummies Questions & Answers

Quick help with UNIX commands (pipes and filters)

Hey all, I need a command line that creates a new file named whatever, say stuff.txt in the current working directory which contains the number of directories in the current working directory, followed by the number of empty files in the current working directory, followed by the name of the... (2 Replies)
Discussion started by: corpsegrinder
2 Replies

6. UNIX for Advanced & Expert Users

i am not able to recall the command typed earlier in unix

i am not able to recall the command typed earlier in unix whenever i press esc key ^[ comes on the unix prompt . so esc k isnt working for me whenever i press backspace key i get ^H on my unix cursor need help (1 Reply)
Discussion started by: murli1200
1 Replies
Login or Register to Ask a Question