Friday, August 27, 2010

delete files older than one year

find ./ -type f -mtime +365 -exec rm {} \;

Not to consider sub directories

find ./ -type f -maxdepth 1 -mtime +365 -exec rm {} \;

Copy a file with time preserve?

cp -p file1 detinationdir

Wednesday, August 25, 2010

How do you move files from linux to windows using ftp?

1. start ftp service in linux
2.In windows open a command prompt.

then change to directory where you want to place
downloaded files

G:\windows-backup>ftp 143.143.143.143
Connected to 143.143.143.143.
220 (vsFTPd 2.0.6)
User (164.76.152.37:(none)): suresh
331 Please specify the password.
Password:
230 Login successful.
ftp> cd /tmp/linuxbackup --> Directory in linux where files present
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
fullback.cpio
fullback.md5
fullback00
fullback01
fullback02
fullback03
226 Directory send OK.
ftp: 77 bytes received in 0.00Seconds 77000.00Kbytes/sec.
ftp> bin
200 Switching to Binary mode.
ftp> prompt n
Interactive mode Off .
ftp> mget fullback0*
200 Switching to Binary mode.
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for fullback00 (4294967296 bytes).

How to start ftp service in Ubuntu?

Start:
$ sudo /etc/init.d/vsftpd start

Stop :

$ sudo /etc/init.d/vsftpd stop

restart:

$ sudo /etc/init.d/vsftpd restart

How do you split a big file into small chunks?

I have big file of 15GB. I want to split this file
into 4GB pieces so that i can burn DVDS. you can
apply following Command

$sudo split -d -b4096m fullback.cpio fullback

above command creates fullback00,fullback01,...etc

How do you see file size in GB?

go to folder where files exits

$cd /tmp/backup_folder

$ du -ahl
17G ./fullback.cpio
.

ex:
suresh:tmp/willardbackup$ du -ahl
4.1G ./fullback01
2.1G ./fullback03
15G ./fullback.cpio
4.1G ./fullback02
4.1G ./fullback00
4.0K ./fullback.md5
29G

How to see Oracle version details?

Connect to your account through sqlplus. then run following:

In oracle 9i,

SQL> select banner from V$VERSION;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for Solaris: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production


In Oracle 10g,

SQL> select banner from V$VERSION;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production