Quantcast

Not a unix expert by any means. A ? for any unix guys

Knuckleslammer

took the red pill
Hello, I'm looking for the syntax with rm to remove all files in a directory older than a specific date. Any help is appreciated. I need to keep the logs in a directory that are 20 days old and blow away anything older. I can't use any gui program like Reflections FTP, there are like 30k files that need to be deleted. FTP just locks up.

Thanks, Kevin
 

Knuckleslammer

took the red pill
splat said:
Well here is a Command line that should work for ya !


First get rid of the files

#find /Knucks_directory -type f -a -mtime +20 -a -exec rm -rf {} \;

then the diectories

#find /Knucks_directory -type d -a -mtime +20 -a -exec rm -rf {} \;
Yeah I have command line access. I'm the DBA, believe it or not, LOL.

here's the directory I need to delete the files in

/d01/apps/pilt/piltcomn/admin/log

so do I do a

find /d01/apps/pilt/piltcomn/admin/log -type d -a -mtime +20 -a -exec rm -rf {} \;
 

SkaredShtles

Michael Bolton
Sep 21, 2003
67,338
13,902
In a van.... down by the river
splat said:
Yup that should do it !
you might want to experiment on a less important diestory though :)
:stupid:

And for Lord's sake do this first:

find /Knucks_directory -type f -a -mtime +20 -a -exec ls -lsa {} \;

That'll give you a full file listing of the files that *will* get removed. But it won't remove them. Review list. If correct, do the rm -rf.
 

SkaredShtles

Michael Bolton
Sep 21, 2003
67,338
13,902
In a van.... down by the river
Knuckleslammer said:
Hey SS, will your command give the dates on the files?

Oracle, what a POFS PIG it is :oink: like 40k files in the directory. Not my doing, it was an older instance that I had to resurrect :dead:

Thanks for the help guys
Yup - ls -lsa will give you full file listing. Something like this in Solaris:

28 -r-xr-xr-x 1 root other 14177 Jun 17 06:42 Makefile
36 -r-xr-xr-x 1 root bin 17935 Aug 16 2004 Makefile.20050617
2 -rw-r--r-- 1 root other 190 Sep 17 2004 aliases
2 drwxr-xr-x 3 root bin 512 Jun 16 13:28 binding
 

Ciaran

Fear my banana
Apr 5, 2004
9,841
19
So Cal
Truley, I am not a geek. For I know not of this geek language that you speak.

I really want to go with Linux at home and learn all this Unix stuff but dang, it looks freaking complicated. :dead:
 

Toshi

butthole powerwashing evangelist
Oct 23, 2001
39,407
8,491
Ciaran said:
Truley, I am not a geek. For I know not of this geek language that you speak.

I really want to go with Linux at home and learn all this Unix stuff but dang, it looks freaking complicated. :dead:
you just have to read a whole bunch of man(ual) pages until you know what you need to know to do your job.
 

sanjuro

Tube Smuggler
Sep 13, 2004
17,373
0
SF
Knuckleslammer said:
so I do the rm -rf /d01/apps/prod/proddata/*.dbf correct?
I would not run a separate command. The whole goal of changing the "-exec" section of your find command is to test what files you are actually "finding" without deleting them. If they are files older than 20 days, you can then change it back to rm -rf, although I would not force any file deletions, but rather check why they did not delete.

Mtime, Atime, Ctime can be confusing, so you want to make sure you delete the right stuff.
 

sanjuro

Tube Smuggler
Sep 13, 2004
17,373
0
SF
Toshi said:
you just have to read a whole bunch of man(ual) pages until you know what you need to know to do your job.
Unix is User-Friendly, it is just picky who its friends are...
 

Ciaran

Fear my banana
Apr 5, 2004
9,841
19
So Cal
sanjuro said:
Unix is User-Friendly, it is just picky who its friends are...
LOl. That's great.

So, if I understand correctly Linux is based on Unix, right?

If I run Linux at home do I have to learn all these commands to install drivers and apps and such? I would love to get away from MS stuff and pirate stuff, but I don't know if I am ready for Linux. (Knowledge-wise, that is)

P.S. Sorry about the potential thread derail
 

Knuckleslammer

took the red pill
Data. PFFFFFFFFFFTTTTTTT............


It's all a bunch of bs. Meaningless numbers on meaningless reports. I love the fools that freak out about their data and reports. Gives me a good laugh. I could give a crap about data.

I heard an ad on the radio on the way home yesterday for connect to your pc.com or something.

"you can connect to your office desktop, while your in Hawaii"

What has this country come to?

I shut down the DB on a Saturday at like 6pm once to put on a small patch. Some fool sent me an email the next day all angry that he couldn't get into the database, LOL.

Why do I even bother to try and figure out people whos primary existance, hobby, life is work.

GET A HOBBY LUSERS.


all you need to to unix is to
1. learn vi.
2. learn reflections (LOL)
3. Couple RM's, couple LS's, little FTP
4. Little help from the NERDS on RM :thumb:
 

sanjuro

Tube Smuggler
Sep 13, 2004
17,373
0
SF
Ciaran said:
LOl. That's great.

So, if I understand correctly Linux is based on Unix, right?

If I run Linux at home do I have to learn all these commands to install drivers and apps and such? I would love to get away from MS stuff and pirate stuff, but I don't know if I am ready for Linux. (Knowledge-wise, that is)

P.S. Sorry about the potential thread derail
Technically, Linux is Unix. It is just another "flavor" of unix, but obviously now the most popular.

Other flavors are usually based on machine architecture, like Solaris runs with Sun or AIX on IBM systems (not PC). They try to keep the commands the same, although device stuff is system specific.

Running it from home is a good idea, if you want to have complete control of your system. Keep in mind basic PC games and applications will not run, but I was using a Redhat desktop at work, and I was surprised how smooth everything ran.
 

Barbaton

Turbo Monkey
May 11, 2002
1,477
0
suburban hell
sanjuro said:
Technically, Linux is Unix. It is just another "flavor" of unix, but obviously now the most popular.
Isn't that only true if you're one of SCO's hooligans? I thought Linus designed Linux to be Unix-like, but it's not actually a Unix derivative like AIX, HP-UX, etc...
 

Pau11y

Turbo Monkey
Hey SS, Fedora Core or FreeBSD? I'm on CU's site deciding what OS to load for my AMD64 that I'm building. There are the two above as well as Suse, and maybe Mandrake aswell. I think Mines does their coding classes w/ GCC and don't use any of the MS C/C++ crap... Hum... I should call them to see what OS they use.
 

sanjuro

Tube Smuggler
Sep 13, 2004
17,373
0
SF
Knuckleslammer said:
Data. PFFFFFFFFFFTTTTTTT............


It's all a bunch of bs. Meaningless numbers on meaningless reports. I love the fools that freak out about their data and reports. Gives me a good laugh. I could give a crap about data.

I heard an ad on the radio on the way home yesterday for connect to your pc.com or something.

"you can connect to your office desktop, while your in Hawaii"

What has this country come to?

I shut down the DB on a Saturday at like 6pm once to put on a small patch. Some fool sent me an email the next day all angry that he couldn't get into the database, LOL.

Why do I even bother to try and figure out people whos primary existance, hobby, life is work.
We are moving the datacenter, and the guys who are setting them have been setting up shelves, laying down wire, and screwing in computers. They have been putting in major hours in what I consider hard work.

I was talking to the DBA staff at lunch, and they insisted that they worked really hard, installing software patches and administrating databases, mostly from the comfort of their homes over their VPN lines.

So if working on databases is too hard for you, switch over to networking and get a good pair of kneepads and an electric drill. You'll stop complaining about working too much from home.
 

Knuckleslammer

took the red pill
sanjuro said:
We are moving the datacenter, and the guys who are setting them have been setting up shelves, laying down wire, and screwing in computers. They have been putting in major hours in what I consider hard work.

I was talking to the DBA staff at lunch, and they insisted that they worked really hard, installing software patches and administrating databases, mostly from the comfort of their homes over their VPN lines.

So if working on databases is too hard for you, switch over to networking and get a good pair of kneepads and an electric drill. You'll stop complaining about working too much from home.

I've done all that chief. I'm not complaining. I'm complaining about the fools that never want to leave work. I got the easiest job in the world. One push of a button and the company is down for 2 days minimum :nuts:

I read the instructions, download a patch, run a script, connect the dots. I got the easist job in the world. I just can't stand sitting on my ass 9 hours a day. That's what's driving me mad.
 

clancy98

Monkey
Dec 6, 2004
758
0
Knuckleslammer said:
Data. PFFFFFFFFFFTTTTTTT............

It's all a bunch of bs.
all you need to to unix is to
1. learn vi.
2. learn reflections (LOL)
3. Couple RM's, couple LS's, little FTP
4. Little help from the NERDS on RM :thumb:
thats ossum.

I am gonna take this into my professor. I knew it was alot easier than the bastard was letting on!
 

sanjuro

Tube Smuggler
Sep 13, 2004
17,373
0
SF
Cool, I just know from working in bike shops (as recently as this weekend), that computer work is definitely easier, so I don't mind connecting at 11pm to run 3 commands then go to sleep.
 

Toshi

butthole powerwashing evangelist
Oct 23, 2001
39,407
8,491
Barbaton said:
Isn't that only true if you're one of SCO's hooligans? I thought Linus designed Linux to be Unix-like, but it's not actually a Unix derivative like AIX, HP-UX, etc...
yup, it may be posix compliant but it's not unix per se.

and Ciaran, to install most apps you'd use at home all you need to know is:

curl -O urlhere/file.tar.gz
gnutar -xzvf file.tar.gz
cd filedirwhateveritisnamed
./configure
make
sudo make install

(download file, untar it, change to the directory created by untarring, run the configure script, compile, install)

:D
 

sanjuro

Tube Smuggler
Sep 13, 2004
17,373
0
SF
Barbaton said:
Isn't that only true if you're one of SCO's hooligans? I thought Linus designed Linux to be Unix-like, but it's not actually a Unix derivative like AIX, HP-UX, etc...
Hmm. I can't say I am some Linux guru, so someone more expert correct me if I am wrong. But my perception is if you use the same commands and similar networking and device configurations, you are an Unix system.

To compare, if you were to log into a switch or a filer for example, you might be able to type in ls or df, or hit control-p for history. But that is not unix because they lack the devices.

I think Brocade was pushing a linux kernel for their switches, which would make them linux machines.
 

Barbaton

Turbo Monkey
May 11, 2002
1,477
0
suburban hell
Toshi said:
yup, it may be posix compliant but it's not unix per se.

and Ciaran, to install most apps you'd use at home all you need to know is:

curl -O urlhere/file.tar.gz
gnutar -xzvf file.tar.gz
cd filedirwhateveritisnamed
./configure
make
sudo make install

(download file, untar it, change to the directory created by untarring, run the configure script, compile, install)

:D
and gnutar isn't supposed to seem like a foreign word to him?
:blah:

for the record, Toshi means "decompress" when he says untar. :)
 

Kornphlake

Turbo Monkey
Oct 8, 2002
2,632
1
Portland, OR
Do all those commands translate to something in english? I remember using dos way back in the day, the comands were mostly acronyms or abbreviations. For example to change directories you'd use CD\ (acronym for Change Directory) to view the contents of the directory you'd use a dir (abbreviation for directory), if the list of files was too big to view on the screen you'd use a /p tag to PAUSE when the screen fills, or a /w tag to list the files in colums the entire WIDTH of the screen. Maybe it's just a different computer jargon and that's why the commands in unix and linux seem so foreign, still I see absolutely no correlation between the command names and what they actually do.
 

Barbaton

Turbo Monkey
May 11, 2002
1,477
0
suburban hell
sanjuro said:
Hmm. I can't say I am some Linux guru, so someone more expert correct me if I am wrong. But my perception is if you use the same commands and similar networking and device configurations, you are an Unix system.

To compare, if you were to log into a switch or a filer for example, you might be able to type in ls or df, or hit control-p for history. But that is not unix because they lack the devices.

I think Brocade was pushing a linux kernel for their switches, which would make them linux machines.
Well, convergent design doesn't mean they're the same thing. It's just built that way so that people can transfer knowledge.

The Brocade box would have a linux component, but I personally wouldn't go so far as to say it's a linux machine. Your BMW with iDrive and your X-box run Windows Embedded, but does that make them Windows machines?
 

clancy98

Monkey
Dec 6, 2004
758
0
Yikes, iDrive is Windows Based!? That is the scariest thing I have ever heard in my life.


i just peed in my office chair. A little bit...


CLancy
 

sanjuro

Tube Smuggler
Sep 13, 2004
17,373
0
SF
Barbaton said:
Well, convergent design doesn't mean they're the same thing. It's just built that way so that people can transfer knowledge.

The Brocade box would have a linux component, but I personally wouldn't go so far as to say it's a linux machine. Your BMW with iDrive and your X-box run Windows Embedded, but does that make them Windows machines?
Not true. I know nothing about X-Box or iDrive software architectures, but any machine using a linux kernel has to be considered a linux machine.

They might remove many of the commands, like tar or cpio, but if the base kernel is linux then it does count. They might not remove any commands at all.

Actually, now that I think about it, an X-Box does have PC components, so if someone was to hack it, you could make it into a PC.
 

SkaredShtles

Michael Bolton
Sep 21, 2003
67,338
13,902
In a van.... down by the river
Pau11y said:
Hey SS, Fedora Core or FreeBSD? I'm on CU's site deciding what OS to load for my AMD64 that I'm building. There are the two above as well as Suse, and maybe Mandrake aswell. I think Mines does their coding classes w/ GCC and don't use any of the MS C/C++ crap... Hum... I should call them to see what OS they use.
Probably. The real geeks tend to gravitate towards FreeBSD. I run Fedora Core 1 on my home PC. I need to reinstall Core 4 at some point, but I like not fu**ing with my home PC. I do enough of that crap at work.
 

SkaredShtles

Michael Bolton
Sep 21, 2003
67,338
13,902
In a van.... down by the river
sanjuro said:
Not true. I know nothing about X-Box or iDrive software architectures, but any machine using a linux kernel has to be considered a linux machine.
Technically speaking, Linux *is* the kernel. Nothing more.

Practically speaking, Linux is a kernel and a bunch of software which make a piece of hardware useful in some way.
 

Toshi

butthole powerwashing evangelist
Oct 23, 2001
39,407
8,491
SkaredShtles said:
Technically speaking, Linux *is* the kernel. Nothing more.

Practically speaking, Linux is a kernel and a bunch of software which make a piece of hardware useful in some way.
ahha, so you call it GNU/Linux every time eh?