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

learn more… | top users | synonyms (1)

2
votes
2answers
100 views

Valgrind /usr/lib files are not regular Linux files

The problem that I encountered today (on an embedded device with Linux) is that some files (specifically, the Valgrind /usr/lib files) are behaving very strange and they are not copy-able with scp ...
18
votes
4answers
6k views

How to properly and easy configure `xdg-open` without any enviroment?

I'm using OpenBox window manager without any desktop enviroment. xdg-open behaves strangely. It opens everything with firefox. $ xdg-settings --list Known properties: default-web-browser ...
1
vote
1answer
9 views

Unzip all non-existing or older files from archive

The behaviour I'd like with unzip is to extract all files, overwriting any that are older than those in the archive, not touching any that are the same age or newer, and to never prompt. The options ...
14
votes
5answers
20k views

Script to monitor folder for new files?

How do I detect new files in a folder with a bash script? I would like to process the files as soon as they are created in the folder. Is this possible to do so or do I have to schedule a script with ...
3
votes
2answers
31 views

fdupes - delete files after comparing two directories

I'm currently trying to solve an issue using fdupes. I'd like to compare two folders with each other, and afterwards delete all duplicate files within one of these directories. Example: Files are ...
38
votes
8answers
21k views

How can I edit multiple files in VIM?

I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time? Also, how can I tell the file name of the ...
3
votes
1answer
42 views

How does `stdin` of linux work?

I know that stdin refers to standard input in linux, usually the keyboard. It can also be referred by file descriptor 0. So, which file descriptor does the (standard input) mouse refer to? Or is it a ...
4
votes
1answer
18 views

. (dot) in file mode [duplicate]

I tar a folder on windows and untar on RHEL machine. ls -l shows a . in file mode and folders are in blue + yellow background. [root@xt-storage-01 apache-tomcat-8.0.5]# ls -l total 120 drwxrwxrwx. 2 ...
5
votes
2answers
263 views

How is the inplace modification of a file being done?

What does the "inplace" modification of a file e.g. via sed -i or perl -i mean? My question is about how this inplace modification is done. Is the file copied the modification is done in the copy and ...
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 ...
9
votes
4answers
3k views

Is there a way of deleting duplicates more refined than fdupes -rdN?

Recently I have the need to delete a lot of duplicates. I am merging three or four filesystems, and I want the space to be used economically. At first, fdupes seemed like it was the best tool for the ...
5
votes
2answers
125 views

File handles and filenames

I read this post. Are file descriptors the same as file handle? While trying to configure the linux kernel, it asks open by fhandle syscalls (FHANDLE) [Y/n/?]. Why is this option provided? Does ...
1
vote
1answer
25 views

How to find which application is creating a particular file in a path? [duplicate]

The issue is that, one particular flat file is getting created in a directory. I'm not sure which application is creating that flat file. I am using Unix environment. Is there any possibility to ...
0
votes
1answer
21 views

Give a user the permission to access files in a directory

I have mounted a volume from NAS storage to my Solaris 10 machine using NFS. I want to give read/write permission for a user to the directories and subdirectories and files. I have tried setfacl -m ...
3
votes
1answer
36 views

How do I use sudo to run multiple commands as another user within a portion of a script?

I'm trying to run the following: if [! -f .owner ]; then creator=$(whoami) sudo -u appuser ksh echo "$creator" >> .owner mkdir test1 test2 test3 exit fi However, the ...
1
vote
2answers
114 views

How would I change file permissions if the file name has a space in it in linux [duplicate]

I would like to know how would I rename and change file permissions of a file that contains a space in the name on Linux. Example The name of my file is: my file I have tried mv my%20file my_file ...
14
votes
3answers
5k views

How to list files that were changed in a certain range of time?

How can I list recursively all files that were changed between 22.12.2011 and 24.12.2011?
-1
votes
4answers
91 views

Need a command sequence that will move files from one directory to another based on a particular year? [duplicate]

I'm looking for a sequence of commands (one liner would be ideal) which will identify all the files created in particular year, and move the resulting files to another directory.
3
votes
1answer
22 views

Can close() block?

For example, if you close a pipe or socket that still has data in its write buffer that hasn't been read by the process on the other end, does close() block until the data is read or the other process ...
8
votes
4answers
547 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: ...
36
votes
5answers
17k views

How to remove duplicate lines inside a text file?

A huge (up to 2 GiB) text file of mine contains about 100 exact duplicates of every line in it (useless in my case, as the file is a CSV-like data table). What I need is to remove all the repetitions ...
2
votes
2answers
113 views

Difference between `ls -c` and `ls -t`

What is the difference between -c and -t options for the ls Unix command? And how can I sort by date of creation with the ls command?
1
vote
0answers
19 views

Recover deleted files on Raspberry Pi? [duplicate]

So I just rm -rf'ed a folder with a few files I need. Yes I know I should've had a backup, but it's just a Pi. It's designed to be played around with! Is there anything I can do to recover that ...
6
votes
2answers
276 views

How to find out which program can open a given file?

Let's say I have a file thesis.pdf or picture.jpg Is there a command which returns a program to open this file with? I am aware of the command file, but it just returns the correct type of the file ...
4
votes
2answers
58 views

How to redirect stdout to a file and read from the same file simultaneously with another task?

I want to run a task (which takes quite a long time) remotely in Ubuntu Linux Bash via nohup and redirect stdout to a file, e.g.: nohup task > out.txt & From time to time I would like to ...
4
votes
1answer
115 views

FILE size limitation according to Robert Love's textbook

From Robert Love's Linux System Programming (2007, O'Reilly), this is what is given in the first paragraph (Chapter 1, Page 10): The file position’s maximum value is bounded only by the size of ...
22
votes
5answers
12k views

Determine which process is creating a file

Given file path, how can I determine which process creates it (and/or reads/writes to it)?
3
votes
2answers
42 views

The reverse of `tree` - reconstruct file and directory structure from text file contents?

We all know we can use tree to get a nicely formatted text "visualization" of the structure of a directory; say: $ tree -spugD /usr/include/boost/accumulators/numeric/ ...
1
vote
2answers
31 views

scp and file owner

What are the reasons that could make a change in a file ownership after scp'ing it from one server to another? The file ownership changed from 'owner' to 'apache'. I used scp -p . The user 'owner' ...
1
vote
4answers
586 views

Solaris 10 : Remove trailing blank lines from multiple files

I'm working on Solaris 10.What is the easiest way to remove blank lines from multiple files at once?
2
votes
1answer
298 views

Hang during 'touch' operation on NFS mount

I have two NFS clients mounted to an openfiler 2.99 NFS share at 192.0.2.3: 192.0.2.1 mounts 192.0.2.3:/mnt/nfs01/volnfs01/share01 with ...
5
votes
1answer
185 views

How could I restrict directory content by file type?

Is there a way to restrict directory content by the file type? For example, I have an upload directory that I only want users to put images in, could I go a step further & actually put a ...
1
vote
0answers
33 views

Removing duplicate files but ignoring certain lines (e.g. embedded timestamp)

I have a bunch of gzipped text files. I am trying to remove duplicate files (using fdupes) but the problem is these files contain a line that has their timestamp in them, and the files are identical ...
2
votes
1answer
21 views

Desktop app run by admin user (but not explicitly with sudo) takes file ownership of shared file

Similar to http://stackoverflow.com/questions/15143614/file-ownership-changes-to-root-after-saving-from-a-program-in-ubuntu but I can't use the answer since I'm not running a command-line app as sudo. ...
3
votes
3answers
39 views

Moving latest files from one directory to another

I'm trying to move newest files from one directory to another directory. The find command finds the files but not moving them to another directory. The destination directory exists. $ cd ...
1
vote
1answer
25 views

Does “freshening” a zip file with the -FS option change the modification time of the file?

I have a zip file that I use as a backup for my work. I use the "freshen" option (-FS) whenever I want to update my backup file. However, the file shows the date of last modification as being the ...
5
votes
1answer
139 views

Cannot cat or grep contents of file

I'm on Debian Jessie. When I open a new textfile with mousepad and save it, then modify it with vim and save it again, I cannot print or grep the contents of it anymore. If I do cat file, nothing is ...
0
votes
2answers
42 views

Getting rsync failures randomly

I am getting the following rsync errors randomly from my capistrano scripts. rsync: stat "/app/test-0.1-SNAPSHOT.jar.SB4uq7" failed: No such file or directory (2) rsync: rename ...
4
votes
3answers
7k views

How to recursively list all hidden files and directories?

I want to list all hidden files and directories and then save result to file. Is there any command for this?
1
vote
1answer
94 views

File size conflict

I am new to UNIX and have a doubt about file size in UNIX (AIX). ls -ltr shows me fileA size as 59096. As per my knowledge this is in bytes ,so it is nearly = 0.06 MB However, a script which should ...
11
votes
3answers
14k views

Find and remove large files that are open but have been deleted

How does one find large files that have been deleted but are still open in an application? How can one remove such a file, even though a process has it open? The situation is that we are running a ...
4
votes
3answers
197 views

A layman's explanation for “Everything is a file” — what differs from Windows?

I know that "Everything is a file" means that even devices have their filename and path in Unix and Unix-like systems, and that this allows for common tools to be used on a variety of resources ...
2
votes
1answer
49 views

How can I tell when a file was compressed?

I want to find out when my log files were compressed by logrotate because when I received them from cron in my email, the logs came in as text in the main body of the email instead. I did: ls -1la ...
3
votes
3answers
54 views

How can I use rename to recursively rename everyting to uppercase

I'd like to recursively rename all files and folders (sub-folders) to uppercase. I found some scripts that will do it to lowercase, but I don't know how to change them so it will do it the other way ...
3
votes
2answers
76 views

Removing blank spaces and tabs from line without messing with line endings

I am trying to remove all spaces on a file without messing with line endings. This is to be run from inside a bash script. I have tried all the solutions here: ...
1
vote
1answer
36 views

How to Link File URLs?

I am currently running WordPress/Woocommerce on an Apache server. I have files for sale on the server, located outside of the public path for security. I am attempting to link the downloadable files ...
0
votes
0answers
24 views

How do I know which process created a file? [duplicate]

Some program keeps creating a Desktop folder in my home directory, although I configured xdg-dirs so that my home directory is my DESKTOP directory, so this shouldn't happen. Anyway, how do I know ...
2
votes
0answers
70 views

`crontab -e` sometimes fails with “Creation of temporary crontab file failed”

From time to time crontab -e fails on me on a Ubuntu box. It is the same for all users including the root and crontab -eu <user> under the root. Goes like this on a regular basis, a success here ...
3
votes
1answer
40 views

Test for a particular file format

This is a followup to Normal looking text file, detected by file as ASCII Pascal program text It seems file can't be trusted all the time. It seems possible that a particular file may be detected ...
0
votes
1answer
32 views

Is it viable to have a file with 700 permissions?

I have been wondering about the following thing: Consider Pc A. Pc A has n users. There is a folder with one file per user. There is some sensitive information for each usere there, so you don't ...