What is the file location?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What is the file location?
# 1  
Old 07-07-2006
What is the file location?

Hi Dudes,
How can we get the details of file system on which a perticular file is located? Is there any way to get the file system (DISK) of a perticular file directly or indirectly?


Thanks in advance

Reg,
Chanakya
# 2  
Old 07-07-2006
Code:
df /path/to/file
# or 
cd /path/to/file
df .

will show a lot of other stuff, but it includes what you want, I believe.
# 3  
Old 07-07-2006
the 'stat' command gives you a lot of information of a file also its location but a bit crypted.


stat /tmp/xx.msg
File: `/tmp/xx.msg'
Size: 4401 Blocks: 16 IO Block: 4096 regular file
Device: 805h/2053d Inode: 30 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ walter) Gid: ( 100/ users)
Access: 2006-06-16 13:51:05.000000000 +0200
Modify: 2005-11-11 18:58:51.000000000 +0100
Change: 2005-11-11 18:58:51.000000000 +0100
# 4  
Old 07-07-2006
stat is mostly for Linux boxes - and you're right it does give the information.
# 5  
Old 07-08-2006
Quote:
Originally Posted by Chanakya.m
Hi Dudes,
How can we get the details of file system on which a perticular file is located? Is there any way to get the file system (DISK) of a perticular file directly or indirectly?


Thanks in advance

Reg,
Chanakya
Well, if it's a command within your $PATH, you can use 'which.'

which bash #Will tell you the path of bash. Try it on ls, find, etc.

Otherwise, use find to locate the file.

Then, you can use /etc/mtab or /etc/fstab to determine the filesystem in use on that partition.

If that doesn't answer your question, please state what you're looking for in a little more detail.

Shawn
# 6  
Old 07-17-2006
Hi All,
The answers given by you solved my issue. Sorry for delayed response.


Thanks a lot..

Regards,
Chanakya M
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Curl to download file from subdivx.com after following location without knowing the file name/extens

This question could be specific to the site subdivx.com In the past, I've been able to download a file following location using cURL but there is something about subdivx.com that's different and can't figure out how to get it to work. I tried the following directly in the terminal with no... (5 Replies)
Discussion started by: MoonD
5 Replies

2. Shell Programming and Scripting

Shell script to read specified value from file and echo to the same location to other file.

Hello. I want to to backup some "default:" values from a file do some other job and after restore that "default:" values back. The problem is that the source and destination file has a lot of default: strings in it but with different values... So.. Here is an example: A part of my source... (6 Replies)
Discussion started by: ausdim
6 Replies

3. Shell Programming and Scripting

Help with copying the list of files from one location to other location

A) I would like to achive following actions using shell script. can someone help me with writing the shell script 1) Go to some dir ( say /xyz/logs ) and then perform find operation in this dir and list of subdir using find . -name "*" -print | xargs grep -li 1367A49001CP0162 >... (1 Reply)
Discussion started by: GG2
1 Replies

4. Shell Programming and Scripting

How to find a existing file location and directory location in Solaris box?

Hi This is my third past and very impressed with previous post replies Hoping the same for below query How to find a existing file location and directory location in solaris box (1 Reply)
Discussion started by: buzzme
1 Replies

5. Shell Programming and Scripting

How to copy a file from one location to another location?

I have file file1.txt in location 'loc1'. Now i want a copy of this file in location 'loc2' with a new file called test.txt. Please help me how to do this in shell script. (1 Reply)
Discussion started by: vel4ever
1 Replies

6. Shell Programming and Scripting

File created in a different location instead of desired location on using crontab

Hi, I am logging to a linux server through a user "user1" in /home directory. There is a script in a directory in 'root' for which all permissions are available including the directory. This script when executed creates a file in the directory. When the script is added to crontab, on... (1 Reply)
Discussion started by: archana.n
1 Replies

7. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

8. Shell Programming and Scripting

Put one string from one location to another location in a file

Hi Everyone, I have 1.txt here a b c' funny"yes"; d e The finally output is: here a b c d e' funny"yes"; (1 Reply)
Discussion started by: jimmy_y
1 Replies

9. Shell Programming and Scripting

Bash copy file contents into an existing file at a specific location

Hi all I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far: File A line 1 line 2 line 3 line 4 ... (6 Replies)
Discussion started by: gshepherd7
6 Replies

10. UNIX for Advanced & Expert Users

copy files from one location to similar location

I need help in forming a script to copy files from one location which has a sub directory structure to another location with similar sub directory structure, say location 1, /home/rick/tmp_files/1-12/00-25/ here 1-12 are the number of sub directories under tmp_files and 00-25 are sub... (1 Reply)
Discussion started by: pharos467
1 Replies
Login or Register to Ask a Question