LinuxQuestions.org
Visit Jeremy's Blog.
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 06-28-2011, 02:09 PM   #1
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Rep: Reputation: 53
ssh support


Hi. I promise I am carefully studying shell use, and much else, but right now I just need the shell instruction to search directories recursively, for files with .swo & .swp extensions, deleting the files as they're found. Thanks!
 
Old 06-28-2011, 02:39 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
@ Reply

Hi there,

Here is the command that you can use:

find / -name '*.swo' -print (This command will show you all the files with the extension .swo). Once verified use the below command (same command with -delete option) to delete the files with that extension. I am suggesting you to run this command first to make sure that it is printing the files that you are intending to delete and there is nothing else getting deleted if the command ran with -delete option.

find / -name '*.swo' -print -delete

I hope this helps.
 
1 members found this post helpful.
Old 06-28-2011, 03:11 PM   #3
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
Thumbs up Much thanks!

Thank you "T." I really can't thank you enough.
 
Old 06-28-2011, 03:14 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
@ Reply

You're welcome. Good to hear that you have got what you were looking for. Enjoy Linux!!
 
Old 06-28-2011, 03:49 PM   #5
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
Two more questions: how do I exclude one file from delete? Also, I overlooked one file before I deleted it. I'm not sure if I need it: /root/.swo Do I need that? If so how can I restore it? Thanks.
 
Old 06-28-2011, 04:22 PM   #6
sandwormusmc
Member
 
Registered: Nov 2006
Distribution: Fedora 15 x86_64
Posts: 76

Rep: Reputation: 24
Quote:
Originally Posted by bluegospel View Post
Two more questions: how do I exclude one file from delete? Also, I overlooked one file before I deleted it. I'm not sure if I need it: /root/.swo Do I need that? If so how can I restore it? Thanks.
Check out the man page for find:

Code:
# man find
I think there is an exclude option in there that supports file patterns. Also, /root/.swo doesn't ring a bell as a necessary file. As for the last question, if you delete a file there is no (easy) way to recover without some low level tools to perform recovery (which I don't know much about unfortunately).

So be very careful on your deletes ...

Edit:
Also, what does your post have to do with SSH support? For better responses, make sure your post title is related to your actual issue ...

Last edited by sandwormusmc; 06-28-2011 at 04:23 PM.
 
Old 06-28-2011, 04:47 PM   #7
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
Thanks Sand.

Quote:
no (easy) way to recover
I meant to restore, as in replace.

Quote:
what does your post have to do with SSH support?
Sorry. I meant, "Help! I need to use shell via SSH," but we're supposed to avoid titles including "help," so I used "support." I figured I could infer that I will be using SSH by including it in the title. See, there is some method to my madness.
 
Old 06-28-2011, 06:53 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Try to use titles that reflect the actual qn; ssh is redundant in this case, its a 'find' qn.

As for restore; depends what you mean. You should be doing backups regularly. If in doubt with a cmd like this, copy the relevant files somewhere else before deleting them, just in case.
For emergencies there are a few things you can try, starting with photorec, but use the LQ Search facility for the many threads on this subject.

HTH
 
  


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
[SOLVED] my version of ssh doesn't support 'Match' and 'ForceCommand'? c0pe Red Hat 6 12-20-2012 05:36 AM
[SOLVED] Parallel multiple ssh tool pseudo tty support bridrod Linux - Server 13 01-27-2011 10:34 AM
Does ssh/sftp support resume dl/ul? lostlyre Linux - Software 2 10-15-2010 07:51 PM
Multilingual support for ssh sessions hussar Slackware 9 07-19-2006 02:04 PM
how to setup mail server support SSH? Rex_chaos Linux - Networking 1 03-17-2003 06:06 PM


All times are GMT -5. The time now is 06:24 PM.

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