Reputation: 15960
I am using the following command remotely from a code and get the complete list of files from AIX box under /web/sample folder
ssh [email protected] ls -lLtp /web/sample
Now I need to tweek this command, in such a way where I want to specify to get the list of file names starting with g*
I tried like the following it didnot work ssh [email protected] ls -lLtp /web/sample g*
I am getting the complete list as above command(1st command)
Please suggest or give me the correct format to make it work
Upvotes: 0
Views: 681
Reputation: 6391
The proper syntax is
ssh [email protected] "ls -lLtp /web/sample/g\*"
Upvotes: 0
Reputation: 532448
Quote the command so that it is not expanded locally, and change directories on the remote end:
ssh [email protected] 'cd /web/sample; ls -lLtp g*'
Upvotes: 2
Reputation: 13271
You could do:
ssh [email protected] -- 'cd /web/sample && ls -lLtp g*'
Also, you might need to add the "d" option to ls, if g* give only one result and if the result is a directory, you'll get the content of this directory.
Upvotes: 1