Use this tag for questions about file management and operations on files.

learn more… | top users | synonyms (1)

3
votes
1answer
60 views

How does the system know when a file has been modified? In particular memory mapped files

If I am looking at a process from outside the process how can I tell which files it modifies? One thing I can do is track calls to write, but a process can map a file to memory and write to the ...
4
votes
2answers
89 views

modify file ownership for files inside tar archive

I am working as user, and I would like to create a tar archive, which when unpacked (by root) will extract its files with root ownership (otherwise root would have to change the ownership manually for ...
5
votes
2answers
132 views

Remove Linux directories containing ONLY old files

We have numerous directories that each contain 2 files, one of which is a hidden file. We want to remove all those directories and their contents that contain ONLY files that have a modification date ...
2
votes
3answers
89 views

Compare two files for matching lines and store positive results [duplicate]

I have two files. File 1: A0001 C001 B0003 C896 A0024 C234 . B1542 C231 . upto 28412 such lines File 2: A0001 A0024 B1542 . . and 12000 such lines. I want to compare File 2 against File 1 ...
2
votes
1answer
195 views

Why do deleted files continually reappear?

I've been having a strange issue recently, where I would delete files from a location (i.e. Desktop), and then empty the Trash. However, a day or so later (I'm not sure exactly what triggers it), the ...
2
votes
1answer
64 views

Display file using Dialog

I have a file on disk which contains some text I want to display on the screen. You can do it like this: dialog --yesno "`cat FILE`" 10 100 However, I'm concerned that if FILE becomes large, I'm ...
14
votes
3answers
541 views

Move files and change ownership at the sametime

On Linux (Debian, Ubuntu Mint...), Is there any option command or something that I can use to transfer files to another user without having to do : sudo mv /home/poney/folderfulloffiles ...
19
votes
4answers
1k views

Is there an “open with” command for the command line?

Does the command line have a way to get a recommended list of programs used to open a particular file, based on the file type? For example, a .pdf file would have an open with... recommendation using ...
4
votes
1answer
65 views

Sharing a local directory between local users with full permissions

How do you share a directory /home/shared between two users "eris" and "discordia" such that both can access the directory in their respective home directory, e.g. /home/eris/shared and ...
4
votes
2answers
143 views

Opening a file with program in background from shell

The command to launch a program, say evince, from bash shell in background is evince & But what if I want to open some file with evince in background? Nor evince myfile.pdf & neither evince ...
14
votes
3answers
2k views

Why isn't there any shell command to create files?

Attention please: I am not asking how to make a file from the command line! I have been using touch for making files for years without paying attention that its main purpose is something else. If ...
0
votes
3answers
642 views

How to write a Java Program / Shell Script combination such that you can call the Java program as a remote command and yet supply a local file?

This is related to How to execute a remote command on a local file? I wrote a simple Java program that prints the first line of a file - import java.io.BufferedReader; import ...
1
vote
2answers
54 views

tar specific files based on a pattern

I got a lot of files with the following format: 2014_04_01_11.txt 2014_04_01_12.txt 2014_04_01_13.txt 2013_03_25_12.txt 2013_04_29_15.txt I would like to tar all theses files into an archive 20?? _ ...
3
votes
1answer
58 views

Merging text files based on their filename

I have hundred of files with the following format: 2013_01_19_xyxyxyx.txt 2013_01_19_xyxyxyx.txt 2014_03_21_xyxyxyx.txt 2014_03_21_zxzxzxz.txt 2014_03_22_abababa.txt 2014_03_22_cbcbcbc.txt etc. I ...
4
votes
2answers
132 views

Faster way to rename duplicate files (identified by fdupes) in another directory?

I have a directory full of pdf files of journal articles, most of which are named by their bibtex key. Some time ago I made a backup on an external hard drive, but I haven't kept it up to date and ...
1
vote
1answer
106 views

File has bytes - appears to be empty

I'm having the following problem: Some text files (also some binary files) on my system are listed with the correct file size but when I open them, they appear empty. >ls -la -rw-rw-r-- 1 user ...
2
votes
0answers
25 views

File viewer (not manager) with dual pane

I have multiple papers, in multiple directories. let us call the papers A, B, C, D... and I have to write reports often, where I have to answer questions like Q1, Q2, Q3, Q4... Now, what often ...
3
votes
4answers
207 views

How can I count all the files on my system from root?

I want to know the total number of files on my server. Can this be done?
3
votes
2answers
63 views

Can I safely read a file that is appended to by another process?

If process A copies files to some location loc and process B regularly copies the files from loc to some other location, can B read a file that is currently in the process of being copied to loc by A? ...
2
votes
4answers
94 views

Can a running script identify the logging context?

Let us say I redirect the STDOUT, STDERR of a program to files. ./script.sh 1> output.log 2> error.log Can the running program find this out i.e. know the paths to these files?
2
votes
2answers
153 views

How to edit /etc/inittab?

I want to edit /etc/inittab in order to get a login prompt on the serial console once the system boots. By default, inittab file complains to be ro. I tried both gksudo gedit /etc/inittab and sudo vi ...
13
votes
2answers
427 views

Is that possible to integrate zip and tar.gz files as directory into the file system

I wonder if there is a way to integrate (it's a bit different from mounting, I think) compressed files as directories into the file system? E.g., one could download a compressed-file.tar.gz to his ...
2
votes
3answers
52 views

How to know the path to a specific file in a zip archive, without extracting it?

I only know the filename but not its exact location. I would like to extract only that file from the archive. And I need to know its location in the archive.
2
votes
3answers
265 views

Merge 2 files based on all values of the first column of the first file

I need to merge below 2 files: file1: TABLES REF-IO HEAD-IO DIFF-IO test 200 500 -300 exam 2 3 -1 final 2 1 1 mail 4 2 2 TOTAL 208 506 -298 ...
2
votes
1answer
61 views

Delete *.txt files by date between MMDDYYYY and MMDDYYYYY

How can I use rm to delete *.txt files between MMDDYYYY and MMDDYYYY ?
1
vote
3answers
111 views

Create directories from a list of files with spaces in name

I have a directory with a list of files in it. All these files have spaces in their names. I would like to create a directory, for each file, with the name of the file except the extension (which is ...
5
votes
3answers
139 views

Find the top 50 directories containing the most files/directories in their first level?

How can I use find to generate a list of directories which contain the most numbers of files. I'd like the list to be from highest to lowest. I'd only like the listing to go 1 level deep, and I'd ...
4
votes
7answers
517 views

How to split a filename list in 5GB sets?

I have a pretty big list of files which I like to group in smaller list of 5GB each for further processing. The file list is in the following form: "size" (from du) "tab" "absolute path", like this ...
0
votes
1answer
73 views

. (dot) shows up as path separator [closed]

I'm hunting a really strange bug: arian@orel:~$ ls ._cache.<tab><tab> Display all 205 possibilities? (y or n) ._cache.apt-file/ ._cache.chromium/ ._cache.chromium.Default/ ...
2
votes
2answers
101 views

How to rename filename with ' or ? in file name?

I have a problem renaming a file that I'm not even sure which special characters I have in the file. I'm using CentOS 6 64bit. When I ls the file: Giko Suzo San?e - Ep1.avi but when view it in ...
1
vote
2answers
66 views

Merge 2 files based on all available values of the first column in both files

I need to merge below 2 files: file1: viewer 23 test 27 remark 2 file2: viewer 2990 exam 200 remark 240 merged file should be as shown below: type value1 value2 difference ...
1
vote
1answer
75 views

List files, directories and executables in current directory

I have php shell and I have function that do just that (but it give me error when I call scandir($path) function because of restriction in php), so I need to use my bash shell to do the same. It can ...
1
vote
2answers
840 views

undelete a just deleted file on ext4 with extundelete

Is there a simple option on extundelete how I can try to undelete a file called /var/tmp/test.iso that I just deleded? (it is not so important that I would start to remount the drive read-only or ...
2
votes
1answer
131 views

remove duplicate files in 2 directories

I have two folders (w/ subfolders) containing files that both contain essentially the same content. Example: /folder/files/data/new /folder/files/data/old Is there way to delete all files in /new ...
11
votes
3answers
540 views

Read the middle of a large file

I have a 1 TB file. I would like to read from byte 12345678901 to byte 19876543212 and put that on standard output on a machine with 100 MB RAM. I can easily write a perl script that does this. ...
2
votes
2answers
89 views

Shell Scripting: how to use part of the file path as the file name?

I have a group of directories, each containing exactly 1 jpeg image, like so- /psds/folder1/image.jpg /psds/someotherfolder/picture.jpg /psds/yetanotherfolder/thumbnail.jpg What is the appropriate ...
7
votes
1answer
57 views

Swap (exchange) two big files in limited environment

Let's say I have two flash memory devices 1GB capacity each. Let's also say each device contains one big file ~ 1GB size. Assuming, I have limited (64MB) RAM and no hard disk drive, what is the ...
1
vote
1answer
32 views

Rotating a file

I have an application which write to a file. Before I run the application, I would like to rotate the file. In others move file.n to file.n+1 file to file.1. I can write a script to do this, but I ...
1
vote
2answers
312 views

cp and mv if the file named already exists

What happens when you give the following commands if the file named done already exists? $ cp to_do done $ mv to_do done
1
vote
2answers
55 views

File not displayed using vi but visible with command ls -l CD*

I can do an ls -l CD* and see the following output. CDTEST userA RW RW R I am logged in as userA. But if I do an ls -l the file does not appear. If I do vi CDTEST it tries to create a new file ...
2
votes
1answer
68 views

Download Only a Part of a File

I am trying to find if it is possible to download a part of a file (any file) via axel or aria2 or any other tools available. For example there is a movie file (because doing this kind of thing ...
2
votes
1answer
137 views

Can not change permissions of files/directories in a chrooted filesystem

I am using Ubuntu 12.04 LTS 64 bits to chroot into a just extracted to my harddrive (with unsquashfs) Squash File System from a Kali Linux v1.0.5 32 bits pendrive for customizations: luis@Fujur:$ ...
2
votes
1answer
59 views

How to link the unlinked files?

When you rm a file it will call unlink(), and unlink() will remove the file from the Directory entry and its inode is freed. But, the actual content of the file is still in the disk. Is there any way ...
8
votes
4answers
548 views

Why does “cat ttyUSB0” not produce output?

I connected an infrared receiver to a USB port ... (the last line of dmesg tells device file) $ dmesg [10496.596063] usb 7-2: new full-speed USB device number 2 using uhci_hcd [10496.751112] usb 7-2: ...
2
votes
1answer
65 views

Equivalent of memmove on files: copy a range of bytes to an earlier position

What is an equivalent of memmove on files with the same input and output file? dd works when I move the file contents towards the right, but not if I move the contents left, since there's no handling ...
3
votes
3answers
482 views

Efficient way to create multiple files

I have been testing find directory which is taking max inodes and while testing I had run touch test_{1..1391803}.txt But it's give me error "-bash: /usr/bin/touch: Argument list too long", now ...
2
votes
3answers
297 views

How to recover from recursive 'chmod -x' on my home folder

I pressed ENTER after typing the following stupid command on my home directory: find . -type f -exec chmod -x '{}' ';' What do you advise as a fix for this. My guess is that I can't do anything but ...
0
votes
4answers
89 views

Copy files without changing owner [duplicate]

How to copy all files from /var/www onto a flash disk without changing owners of folders in the /var/www folder? (Or how to insert the whole /var/www folder into an archive and put it onto a flash ...
5
votes
2answers
204 views

Difference between xattr and chattr

What is the relation and the difference between xattr and chattr? I want to know when I set a chattr attribute in Linux what is happening inside the Linux kernel and inode metadata.
0
votes
1answer
103 views

I am the owner of a file and I have write access: why can't I save?

I am on OSX 10.9.2 I am locked out of postgres and trying to modify pg_hba.conf to get back in. http://stackoverflow.com/questions/11919275/can-not-enter-and-change-postgresql-pg-hba-conf-file I run ...