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

learn more… | top users | synonyms (1)

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
76 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
958 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
134 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
557 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
92 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
58 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
33 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
331 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
69 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
145 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
608 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
66 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
523 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
299 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
95 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
211 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 ...
0
votes
2answers
49 views

file(1) command termination when using the -f - option

Say I'd like to use the file -f - command inside a script, and send some input using the stdin, when I'm finished I'd like to terminate it gracefully, but unfortunately I haven't found any way to do ...
4
votes
3answers
226 views

Hidden Files&Directories in user's home directory [closed]

I am in my user's home directory, I do: ls -a Then it shows me large number of hidden files and directories in my user's directory. Which of them I am allowed to remove? Which ones are necessary ...
4
votes
1answer
135 views

When was file created [duplicate]

How can i see when a file was created. I have looked at man page ls -lc is for last modification of file status ls -lu for access time ls -l not exactly indicated which time, last changed? I ...
0
votes
1answer
121 views

Updating last modified time of a file

I have created a script to read 15 pcap files from a folder and merge then into one file using mergecap command. I want the merged file to have the creation time same as the first file of the 15 files ...
5
votes
3answers
395 views

Why does this executable still execute after I deleted it?

I deleted the executable, so why is it still running? root@raspberrypi:/test# ls -la total 11096 drwxrwxrwx 2 pi pi 4096 Mar 12 18:26 . drwxrwxr-x 11 pi pi 4096 Feb 28 13:50 .. -rwxrw-rw- 1 ...
1
vote
0answers
60 views

Changing file time using touch

Im trying to change the file time of a m#merge the files to a temporary file. mergecap -w "${dir_dcn}"/merge_dcn.pcap "${FILES_dcn[@]}" touch -r "${FILES_dcn[14]}" dcn_file ls -l dcn_file ...
2
votes
2answers
52 views

How to list all the files which were not created on Thursday

I need to delete old backups but I only want to keep Thursday Backups and delete the rest of the backups. Give me some kungfu tips. I'm on RHEL if that makes a difference.
2
votes
1answer
121 views

How to copy files *to* a camera?

I'd like to copy a firmware update file to my Canon 7D camera. After it was auto-mounted by thunar + thunar-volman + gvfs-gphoto2 I tried the following: $ cp eos7d-v205-win/7D000205.FIR ...
2
votes
2answers
99 views

Tool to show PID and file I/O in realtime

I need to watch a program which modifies some files. I don't know which files the process is modifying_. So I'm looking for a tool that basically outputs a PID, and lista the files being ...
2
votes
4answers
85 views

Wrapper command that runs program in temporary directory and deletes it after execution [duplicate]

I want to write a command that: takes another command as its arguments does a 'cd' to a temporary folder executes the command passed in the arguments removes the temporary folder afterwards ...
4
votes
1answer
928 views

Changing a file's “Date Created” and “Last Modified” attributes to another file's

I'm using merge cap to create a merge pcap file from 15 files. For the merged file, I have changed the name to that of the first of the 15 files. But I would also like to change the merged file's ...
2
votes
2answers
49 views

How to tell which files have been created by an application?

I want to find out what files an application has created or modified. In the old days it was easy. cc foo.c created a.out, cc -o foo foo.c created foo, cc -c foo.x created foo.o. Now applications ...
3
votes
4answers
143 views

Removing file which doesn't have any permissions and attributes

I have a file on my external hard disk named ._Icon^M.I ended up with this after using my hard disk on old Mac platform machine. I want to delete this file but unable to. For the command 'ls -al' it ...
9
votes
2answers
1k views

Fastest way to concatenate files

I've got 10k+ files totaling over 20GB that I need to concatenate into one file. Is there a faster way than cat input_file* >> out ? The preferred way would be a bash command, Python is ...
1
vote
2answers
179 views

Free disk space from a JBoss log file which is still being written to

Is there any locking on the content, imposed by the process if at all the process is using the file. We host a JBoss app server on a RHEL 6.4 OS and due to the disk space constraints we have decided ...
3
votes
4answers
157 views

How to get folder size ignoring hard links?

I use rsnapshot for backups, which generates a series of folders containing files of the same name. Some of the files are hard linked, while others are separate. For instance, hourly.1/file1 and ...
3
votes
3answers
82 views

Why are file handles a scarce resource?

I feel like every tutorial I read on resource management in server settings starts by asserting that file handles are a scarce resource, and we should therefore aim to keep the list of open files to a ...
1
vote
6answers
439 views

Program a file to self-destruct at a given time

Does anyone know whether there is a command in linux that can set attributes to file so that the file can disappear after certain time. For example, if I set one attribute to file as "1/1/2015", so ...
3
votes
3answers
247 views

Transform a directory into file or a file into directory

I wanted to create a file named test. Accidentally I run mkdir test instead of touch test. Is it possible to convert test directory in a file named test? What about converting a file named test into ...
2
votes
2answers
30 views

Search for files by content only in trunk subdirectories

I think its a simple question, but the answer is probably a little more complicated :P Edit: Actually, its not complicated at all!^^ So I have a directory with multiple svn projects and I would like ...
0
votes
0answers
200 views

NFSv4 which “domain” to put in idmapd.conf?

I'm using NFSv4 but suddenly when the NFS Server got rebooted, all the files on the Clients are having nobody ownerships after the Server is booted and started its whatever services again. Then I ...
0
votes
0answers
15 views

Net-SNMP Application

I don't know if this is the right place to ask this question, but, does anyone knows about Net-SNMP. Is it possible to not truncate the log file whenever snmptrapd is restarted? The logs are being ...
0
votes
2answers
95 views

Make file in linux readonly

Is there a way to make a file readonly permanently in linux. Or can I put a password to a file to make it readonly, then apply that password again to change its permission, or before they can alter ...
0
votes
1answer
51 views

Capture Error of LS to file [duplicate]

#!/bin/sh if [ $(ls sample01.log | wc -l) = 1 ] then echo "File Found" > lsOutput.log else echo "File Not Found" > lsOutput.log fi But if sample01.log is not already existing my code already ...
0
votes
1answer
205 views

LS Command output to file [closed]

I want to capture to a file the output of the ls command ls >> lsOutput.log This one works if executed in the command line. But when put inside a shell script (lsOutput.sh), returns ...
4
votes
1answer
110 views

measure amount of data read from /dev/random

background I have written a collection of bash scripts (most of them in German only yet but if you are interested; download the archive not the single scripts) which help users create high-quality ...
-1
votes
1answer
52 views

What is a file? [closed]

I thought that the file is a reserved place on disk and it is a Record collection but i found that it is a wrong definition because the empty file capacity is 0kb so it can't be a reserved place on ...
4
votes
1answer
88 views

Is there a way to cat files as they are created? [duplicate]

Unlike the answer to this question (Can a bash script be hooked to a file?) I want to be able to see content of files that haven't been created yet as or after they are created. I don't know when ...
1
vote
0answers
53 views

NAS device failed and I am attempting to get data back - HELP! [closed]

Not a Linux guy!~ Tried on windows pc and failed. Put the Nas device hard drive is in an older pc with Kali in forensic mode because device failed and all no longer allowed access to data on hard ...
2
votes
2answers
442 views

How can I restore file timestamps of video recordings using the embedded metadata?

I'm looking for a command that will read the metadata of a ‘*.mp4’ file and touch the file's timestamp with the creation time of the video. The command should be read-only with respect to the file ...