LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-21-2012, 07:14 AM   #1
hongkildong
LQ Newbie
 
Registered: Nov 2012
Distribution: Debian
Posts: 2

Rep: Reputation: Disabled
Keyboard shortcut for last entered param in command line ?


I watched a linux tut video and noticed some cool trick. Can you explain how he managed to insert string "/sbin/mkfs.ext2" at 0:30 ? He hadn't selected it before. Is it some sort of keyboard shortcut for last entered param ?
http://www.youtube.com/watch?v=ZIQCd1RvbGk

Last edited by hongkildong; 11-21-2012 at 11:23 AM.
 
Old 11-21-2012, 08:45 AM   #2
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,854

Rep: Reputation: 237Reputation: 237Reputation: 237
I don't speak that language. Maybe Ctrl+P for last entered.
 
1 members found this post helpful.
Old 11-21-2012, 09:47 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
You can print last argument of previously run command using ALT + . (ALT key plus dot) keyboard combination.
Code:
bash$ ls -ld /home/jack/test
bash$ cd (ALT + .)
And it will print:
Code:
bash$ cd /home/jack/test
Note: CTRL+P will print previously run command, not last argument of previous cmd.

Last edited by shivaa; 11-21-2012 at 09:51 AM.
 
1 members found this post helpful.
Old 11-21-2012, 10:01 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Ctrl+Alt+y would also do it. Reference here.
 
2 members found this post helpful.
Old 11-21-2012, 10:10 AM   #5
mandyapenguin
Member
 
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 106

Rep: Reputation: Disabled
Simply you can use up arrow key to get last command.
And using exclamatory(!) symbol also you can excecute the commands of previous command(s).
For example I have ran 3 commands
Code:
vi /etc/samba/smb.conf  -->1st
ping -c5 google.com     -->2nd
tail -f /var/log/syslog -->3rd
Now if I again want to open /etc/samba/smb.conf file, just type & hit enter
Code:
!v
Using history numbers also you can run any previosly excecuted commands
Code:
#history
2023  cal
2024  man dig
2025  nslookup localhost
2026  echo $?
2027  whoami
2028  w
2029  who
2030  tree -d /etc
2031  vi /etc/samba/smb.conf 
2032  ping -c5 google.com
2033  tail -f /var/log/syslog
If you want to run command of history number 2030 just type
Code:
!2030
Here are some Linux Keyboard Shortcuts

Last edited by mandyapenguin; 11-21-2012 at 10:17 AM.
 
1 members found this post helpful.
Old 11-21-2012, 11:20 AM   #6
hongkildong
LQ Newbie
 
Registered: Nov 2012
Distribution: Debian
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks! You are so incredibly helpful )
 
Old 11-22-2012, 04:16 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by hongkildong View Post
Thanks! You are so incredibly helpful )
Yes -- about re-running complete commands. The OP was about pasting the last argument of the last command.
 
  


Reply


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
how to switch to command line from GUI using keyboard shortcut tj_linux Linux - Newbie 16 05-16-2010 07:29 AM
[SOLVED] Shut down Puppy Linux 4.20 from command line or keyboard shortcut without freezing ubume2 Linux - Newbie 2 09-18-2009 12:27 PM
[SOLVED] How to turn off screen through keyboard shortcut or command sumeet inani Linux - Newbie 1 06-09-2009 11:08 PM
Command Line for creating shortcut icons indraveni Linux - General 20 05-08-2006 11:46 PM
KDE3 execute command on keyboard shortcut hamsterdude Linux - General 10 07-21-2003 02:36 PM


All times are GMT -5. The time now is 02:37 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration