Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does this linux command do: "cd !!:1"

Tags:

linux

cd

In linux command cd, after make a dir, I can use "cd !!:1" to enter it, but what exactly does !!:1 mean, I can't search it by google, because it include special chars.

like image 629
user218867 Avatar asked Jun 27 '14 02:06

user218867


1 Answers

That will change directory to the first argument of the previous command

For example

% ls foo bar
% cd !!:1

is equivalent to

% ls foo bar
% cd foo

Also !!:0 gives you the actual command (less arguments), !!:2 the second argument, !!:$ the last argument, and !! the whole command line.

like image 70
Bull Avatar answered Oct 01 '22 23:10

Bull