ls command in Remote Server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ls command in Remote Server
# 1  
Old 05-30-2008
ls command in Remote Server

Unix Box: IBM AIX
Shell : K-Shell

When i logged into a remote server through FTP, and tried to find only required month file by typing `ls -ltr *200805`, the output is "ls remotefile localfile". I coudnt understand this.
What is want is get into the remote server and get the count of required files like "ls -ltr *200805 | wc -l". This is working in my machine but not on remote directory. how can i do this. Advance appreciations for the help
# 2  
Old 05-31-2008
The ls command option in ftp is not the same as ls(1). It supports a very limited set of options. Read the ftp man page for more information.
# 3  
Old 05-31-2008
Run the command via ssh:
Code:
ssh host "ls -ltr *200805 | wc -l"

# 4  
Old 05-31-2008
you might have to check mdtm utility in Net::FTP module.

But again, it will not work in ftp service hosted in windows machine
# 5  
Old 05-31-2008
Quote:
Originally Posted by danmero
Run the command via ssh:
Code:
ssh host "ls -ltr *200805 | wc -l"

With OP's case I think its not possible, where access to specified directory is possible only through ftp login.

Had it been ssh login, there shouldn't be any problem at all.
# 6  
Old 06-02-2008
"ssh host ls -ltr *200805* | wc -l"

When i type this, it says invalid command.
ssh is not working.
What is this ssh
and what should i put in place of host. (remote machine name or local machine name)
# 7  
Old 06-08-2008
What about:
Code:
ssh host "ls -ltr *200805* | wc -l"

Secure Shell - Wikipedia, the free encyclopedia

Quote:
Originally Posted by vasuarjula
and what should i put in place of host. (remote machine name or local machine name)
remote host.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies

2. UNIX for Beginners Questions & Answers

How to run command on remote server?

Hi I am trying to write a script which when I run from server A it execute few command on another server say B and show me the output. below is the script but it is not showing me the o/p of B machine but instead showing me A machine o/p every time. #!/bin/bash for i in `cat... (14 Replies)
Discussion started by: scriptor
14 Replies

3. Shell Programming and Scripting

Sudo connect to a remote server and execute scripts in remote server

Hello Every one!! I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server. Before this I am using a sudo command to change the user. The place where I am stuck is, I am able to connect to the... (6 Replies)
Discussion started by: masubram
6 Replies

4. AIX

Command to connect to remote AIX server

Hi All, Im looking for a command that can remotely connect to another AIX machine and execute scripts present in that server(Possible scenarios are a complete a restart of 3 servers in a cluster through a single script execution present in one of the servers). Im relatively new to AIX and... (5 Replies)
Discussion started by: Vishakh
5 Replies

5. Shell Programming and Scripting

Need script to run the command in remote server

hi, I need script to perform below task. 1. Read the IP address 2. copy the script from origin server to destination. 3. get root access on destination server 4. run the script on destination server 5. return to the origin server Code: #!/bin/bash echo "Enter Server IP... (5 Replies)
Discussion started by: bapu1981
5 Replies

6. UNIX for Dummies Questions & Answers

Executing ls command in remote server

Hi Guru, I have a requirement where i need to list the *.csv files in my remote server and copy a file from that server to my unix server I wrote dis code #!/bin/sh . /home/aaa/bb/GlobalHost.sh export HOST export USER export PWD ftp -n $HOST <<END_SCRIPT quote USER $USER quote... (1 Reply)
Discussion started by: pssandeep
1 Replies

7. Solaris

Running command on Remote server

Hi, I have username/password for a remote server. I would like to have list of filenames and their size in a particular directory of remote server. Now Problem is - I can not use rsh command as I can not modify rhost file of remote server. Thanks in advance. Sanjay (1 Reply)
Discussion started by: sanjay1979
1 Replies

8. Shell Programming and Scripting

ls -ltr command On Remote server

I am writing a script where in i have to log into a remote machine and check for necessary file by typing (ls -ltr *200505) (this gets all 05month of 2008 yr files) and if files are found get them to the local machine. If not found print a message saying no files on local machine. When i was... (2 Replies)
Discussion started by: vasuarjula
2 Replies

9. AIX

ls command in Remote Server

Unix Box: IBM AIX Shell : K-Shell When i logged into a remote server through FTP, and tried to find only required month file by typing `ls -ltr *200805`, the output is "ls remotefile localfile". I coudnt understand this. What is want is get into the remote server and get the count of required... (0 Replies)
Discussion started by: vasuarjula
0 Replies

10. Shell Programming and Scripting

remote server command in a job

I need a cron job to shut services running on other nodes, do some db maintenance, then restart the remote services. This is HP-UX 11.00. I cannot get remsh to work, even interactively. Per man page, does not prompt for password. I get: remsh appserver -l oracle stop_services remshd:... (2 Replies)
Discussion started by: Jimbo
2 Replies
Login or Register to Ask a Question