Saturday, July 9

FTP : tranfering file from server to desktop

Just open a command prompt in remote desktop,

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

D:\home\Krish-adm>cd desk*

D:\home\Krish-adm\Desktop>ftp
Connected to HOST.
220 SERVER FTP server (Version wu-2.6.2+Sun) ready.
User (HOSTNAME:(none)): Weblogic
331 Password required for weblogic.
Password: *******
230 User weblogic logged in.
ftp> bin
200 Type set to I.
ftp> hash
Hash mark printing On  ftp: (2048 bytes/hash mark) .
ftp> cd /
250 CWD command successful.
ftp> get
200 PORT command successful.
226 Transfer complete.
ftp: 498 bytes received in 0.00Seconds 498000.00Kbytes/sec.
ftp> bye
221-You have transferred 498 bytes in 1 files.
221-Total traffic for this session was 1001 bytes in 1 transfers.
221-Thank you for using the FTP service on HOST.
221 Goodbye.

D:\home\Krish-adm\Desktop>

Change Managemant Process

Thursday, June 30


Create tape archives and add or extract files.
Note: A ".tar" file is not a compressed files, it is a collection of files within a single file uncompressed. If the file is a .tar.gz ("tarball") or ".tgz" file it is a collection of files that is compressed. If you are looking to compress a file you would create the tar file then gzip the file.

How to tar a file

 SYNTAX:  
 tar  -cvf  < filename >.tar  /< File directory location >/

 Example: 
 tar -cvf domainconfig_bms.tar domainconfig
 tar -cvwf file.tar myfile.txt

  • c – create a new archive
  • v – verbosely list files which are processed.
  • f – following is the archive file name
  • z – filter the archive through gzip 
  
How to untar a file

SYNTAX: 
tar  -xvf  < filename >.tar
tar  -xvwzf myfile.tar
tar  -xvwzf myfile.tar.gz 


Example: tar –xvf  domainconfig_bms.tar

inode (index node)

The inode (index node) is a fundamental concept in the Linux and UNIX file system. Each object in the file system is represented by an inode.

What is Inode?

Definition:
An inode is a data structure on a traditional Unix-style file system such as UFS or ext3. An inode stores basic information about a regular file, directory, or other file system object.
In a file system, a file is represented by an inode. Inodes are data structures that contain information about files that are created when a file system is created. Each file has an inode and is identified by an inode number in the file system where it resides.
The following information are stored in inode.
Owner and group owner of the file.
• File type
• Permissions on the file.
Date and time of creation, last read and change.
• Date and time this information has been changed in the inode.
• Number of links to this file
• File size
• An address defining the actual location of the file data.
Only information that is not stored in inode is its file name and data.

How do I see file inode number?

You can display the inode number associated with a file, use "ls" command along with " -i" option
inode 

Inode application:

If we have files in our system without name or with special characters then we can use inode to remove those files.
rm cannot be used to remove files having blank name or name with special characters.
For Ex:
Below image shows result of ls –lrti. You can see file without name, but with inode number as 2562.
We can use below command to remove this file:
This way we can remove unwanted files from our system and can save disk space.
To remove files having created with control characters or characters which are unable to be input on a keyboard or special character such as ?, * ^ etc. You have to use indoe number to remove file.

Tuesday, June 28

Mount Comamnd In Unix/Linux


Mount Comamnd In Unix/Linux

The Unix command line utility mount instructs the operating system that a file system is ready to use, and associates it with a particular point in the system's file system hierarchy (its mount point). The counterpart umount instructs the operating system that the file system should be disassociated from its mount point, making it no longer accessible. The mount and umount commands requireroot user privilege or the corresponding fine-grained privilege, unless the file system is defined as "user mountable" in the /etc/fstab file (which can only be modified by the root user).

Use
The second partition of a hard disk is mounted with the command
$ mount /dev/hda2 /new/subdir
and unmounted with the command:
$ umount /dev/hda2 
or 
$ umount /new/subdir
 
To list all all mounted fill systems
$ mount 
 
To remount a partition with specific options
$ mount -o remount,rw /dev/hda2
 
To Mount all file system in fstab
$ mount -a
 
Return Codes
 
       mount has the following return codes (the bits can be ORed):
 
       0      success
       1      incorrect invocation or permissions
       2      system error (out of memory, cannot fork, no more loop devices)
       4      internal mount bug or missing nfs support in mount
       8      user interrupt
       16     problems writing or locking /etc/mtab
       32     mount failure
       64     some mount succeeded
Files


       /etc/fstab         file system table
       /etc/mtab          table of mounted file systems
       /etc/mtab~         lock file
       /etc/mtab.tmp      temporary file
       /etc/filesystems   a list of filesystem types to try

touch command:


touch command:

We all know the command touch and we generally use it for creating a 0 byte file (similar to “filename” or “cat /dev/null > filename” or “cp /dev/null filename”). But many of us don’t know that the main use of touch is to update/change the access, modification and last changed times of a file.

Basic Options:

touch 123.txt – will update the times of 123.txt to current time OR creates 123.txt with current date, if NOT exists.

touch –t “timestamp” 123.txt - will update the times of 123.txt to timestamp OR creates 123.txt with timestamp.

Timestamp - [[CC]YY]MMDDhhmm[.SS]

                          CC   The first two digits of the year. (optional, if its 19)

                          YY   The second two digits of the year.  [CCYY is optional, if its same year)

                          MM   The month of the year (01-12).

                          DD   The day of the month (01-31).

                          hh   The hour of the day (00-23).

                          mm   The minute of the hour (00-59).

                          .SS   The second of the minute (00-61). (optional, if its 00)

touch -t 01010000.00 123.txt
-rw-r--r--   1 vs1250     ospcm            0 Jan  1 00:00 123.txt

touch -t 201501010000.00 123.txt
-rw-r--r--   1 vs1250     ospcm            0 Jan  1  2015 123.txt


touch -t 8601010000.00 123.txt
-rw-r--r--   1 vs1250     ospcm            0 Jan  1  1986 123.txt

Now, whatever we see above will update the timestamps of both access and modification times of the file.

–a option is to change only the access time and
–m option is to change only the modified time.

touch -a -t 201501010000.00 123.txt - will update the access time of123.txt to timestamp. If NOT exist, it creates 123.txt with timestamp as access time and current time as modified time.
touch -m -t 201501010000.00 123.txt - will update the modify time of123.txt to timestamp. NOT exist; it creates 123.txt with timestamp as modified time and current time as access time.

-r option is to change the times of a file with that of another file.

touch -r 123.txt newfile.txt - will update the times of newfile.txt with that of 123.txt.
-rw-r--r--   1 vs1250     ospcm            0 Jan  1 00:00 newfile.txt
-rw-r--r--   1 vs1250     ospcm            0 Jan  1 00:00 123.txt

You can mix the combination of the options and use them for various needs. BUT, always –t and –r should be used exclusively.

cron: Job Scheduler


cron: Job Scheduler
The crontab utility is mostly used to run jobs at the same time every day, every month, or every year. Every minute, the system checks a system file, called crontab, to see which (if any) processes/jobs need to be started.
There are four ways to manipulate the crontab file:     

crontab [filename] 

crontab -l [username] 

crontab -r [username]  
NOTE: Be careful in using the first method: if a crontab file already exists, it will be overwritten!! (To avoid the file being overwritten, escape using CTL-c, NOT CTL-d).
Every line in the crontab file contains six fields, each separated by a space. A field may contain more than one value, each separated by a comma. An $\ast$means ``all values".
The fields are:
  1. minute: values are 0 to 59.
  2. hour: legal values are 0 to 23.
  3. date of the month: 1 to 31.
  4. month: 1 to 12 (Jan - Dec).
  5. day of the week: 0 to 6 (Sun - Sat).
  6. Bourne shell command.
Here is an example of what a crontab file would look like:
0 0 * * * /usr/bin/new.messages 
0,15,30,45 * * * * /usr2/people/cantin/check.mail 
0 0 1 1 * /usr2/people/cantin/new.year.message
The first line on the above example runs the command new.messages at 0 minutes, 0 hours (midnight), every day, every month (i.e., every day at midnight).
The second line runs /usr2/people/cantin/check.mail every fifteen minutes.
Finally, the third entry runs new.year.message the first of January, at midnight.