Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 08-29-2013, 09:52 PM   #1
LQ Newbie
Registered: Aug 2013
Posts: 6

Rep: Reputation: Disabled
Putty won't accept command longer than a few lines


I'm trying to delete a large number of files from my web site using the "rm -f" command in Putty:

i.e. rm -f myFile.txt myFile1.txt myFile2.txt, myFile3.txt, myFile4.txt, etc.

For some reason, when I paste more than 4 or 5 lines into Putty, the text gets truncated. I have several thousand files to remove so I really need this to work. Even if I could delete 50 files at a time I would be happy.

I found a similar thread on the forum about the same issue, but I don't think it was ever resolved:

I'm doing everything properly like pressing Shift+Insert to paste the text into the command window, but the software itself just doesn't seem to accept more than a few lines at once. I tried shortening my list multiple times with the same result.

Any help is greatly appreciated. I really need this to work asap.
Old 08-30-2013, 12:05 AM   #2
Registered: Oct 2001
Distribution: Mint 15
Posts: 770

Rep: Reputation: 51
First off, are you sure that it is Putty that is the problem? Open a text document and paste what is in you clipboard into the document. See if it matches what you expected.

I'm pretty sure that it will, but you should check in any case.

So far, all that I can come up with is extending the size of your window (which ties in to an old bug where text outside of that window was getting truncated). But I figure that you would have already tried this.

Is it possible that characters in your paste string are acting like control codes?

And you don't have it set up to select text *blocks* instead of text lines by mistake?


"4.11.4 Default selection mode

As described in section 3.1.1, PuTTY has two modes of selecting text to be copied to the clipboard. In the default mode (‘Normal’), dragging the mouse from point A to point B selects to the end of the line containing A, all the lines in between, and from the very beginning of the line containing B. In the other mode (‘Rectangular block’), dragging the mouse between two points defines a rectangle, and everything within that rectangle is copied.

Normally, you have to hold down Alt while dragging the mouse to select a rectangular block. Using the ‘Default selection mode’ control, you can set rectangular selection as the default, and then you have to hold down Alt to get the normal behaviour.
Old 08-30-2013, 07:00 AM   #3
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,714

Rep: Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280
If you are deleting all the files it may be easier to delete the entire directory (assuming no subdirectories) with "rm -r <name>" and recreate the directory.

Another way to delete a lot of files, but not all, is to select some characteristic of the file name that groups it - something like "rm a*" will delete all files starting with "a" (up to about 10,000 files that is -it varies depending on how long the file names are- after that you can get a parameter list overflow error).
1 members found this post helpful.
Old 08-30-2013, 12:47 PM   #4
LQ Newbie
Registered: May 2013
Location: USA
Distribution: Android, Mint, Ubuntu
Posts: 12

Rep: Reputation: 4
Right. I agree with jpollard. You want to place those files somewhere and delete the entire directory. For instance if there are files in the directory which you want to keep, then choose the lesser action and move one set away from the other. Or use wildcards which identify the specific subset of files you wish to delete; however I'm more a fan of placing the "to be deleted" files in a certain place for deletion.
Old 09-02-2013, 09:26 AM   #5
LQ Newbie
Registered: Aug 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
I think I finally figured out why this is happening. So I tried it again, also using the methods that were suggested here, but still without any luck unfortunately.

I then tried it on a different web site/server using a "root" log-in. And surprise: I can paste as many lines as I want as long as I'm logged-in as "root".

However, on this particular server, I don't have a root log-in account. I only have a personal user account. Even though I can perform a big deletion task on my one server, I still can't do it on the server that actually needs this task done on it.

So I guess logging-in as "root" is a prerequisite for this? Are there any other ways around it?


Last edited by puttyguy; 09-02-2013 at 09:27 AM.
Old 09-02-2013, 11:31 AM   #6
Registered: Nov 2011
Location: Australia
Distribution: Arch, LFS
Posts: 166

Rep: Reputation: 37
if you know all the file names you want to delete, paste them into a script to delete them and upload it to your sever and run it; of course, it needs to be said that you should be very careful with this.
Old 09-03-2013, 01:59 PM   #7
LQ Newbie
Registered: Aug 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Originally Posted by basica View Post
if you know all the file names you want to delete, paste them into a script to delete them and upload it to your sever and run it; of course, it needs to be said that you should be very careful with this.
Can you provide more information about this?

Alternatively: Is there a reliable desktop macro that I can I use to simply copy each file into SSH and delete it?

I have a list of all the files that I want to delete in a text file, with "rm -f /path/file.php" on each line.

I would want the macro to copy each line over to PuTTY and simple click the enter key which would delete it.

I use iMacros for the Web, but is there something simple like this that works on the desktop?

Last edited by puttyguy; 09-03-2013 at 02:10 PM.
Old 09-03-2013, 02:58 PM   #8
Registered: Sep 2012
Distribution: RHEL5/6, CentOS5/6
Posts: 216

Rep: Reputation: 38
There are several ways to do it, even without scripting.
Ant to be honest, I'd try to figure out some pattern instead of typing 1000+ file names into the CLI.

In case you had a Windows machine in place running WinSCP you could just select the files you want to delete and let WinSCP do the job for you.

Do you have any file manager installed on the system, e.g. good old midnight commander? Use that one.
Webmin could be used for this as well.
it would probably make sense to install mc for tasks like this, but Webmin i'd only use if it was there anyway.
Old 09-03-2013, 03:22 PM   #9
LQ Newbie
Registered: Aug 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
I have WinSCP also...

I definitely do not want to copy and paste all the URLs, but that's why I was thinking a macro might be good for the task. I've used iMacros before, but am not familiar with any desktop macros.


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
Sendmail won't accept mail Zmyrgel Linux - Server 8 05-25-2010 04:12 AM
bash script stdin accept values separated with new lines, commas, spaces m4rtin Programming 6 12-30-2009 07:22 AM
Sed command to print matching lines and 2 lines above.. DX398 Programming 12 10-01-2008 09:25 AM
Proftpd won't accept connections cL4YmAN Linux - Newbie 0 06-09-2004 04:33 PM
script for a command that won't accept wildcard value hemp4fuel Programming 4 05-24-2004 06:30 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:39 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration