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

learn more… | top users | synonyms (1)

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
17 views

. (dot) in file mode

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 ...
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 ...
1
vote
1answer
24 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 ...
5
votes
2answers
123 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 ...
0
votes
1answer
19 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 ...
5
votes
2answers
260 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 ...
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
113 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 ...
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 ...
2
votes
2answers
112 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
275 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
114 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 ...
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' ...
5
votes
1answer
184 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 ...
2
votes
1answer
20 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. ...
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 ...
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 ...
3
votes
3answers
37 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 ...
0
votes
2answers
41 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 ...
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
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: ...
3
votes
3answers
53 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 ...
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 ...
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 ...
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 ...
3
votes
2answers
40 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/ ...
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 ...
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 ...
3
votes
1answer
263 views

“file” command confusing C & C++

When using file to check some file types, I noticed that it seems to incorrectly label C++ files as C files: $ file User.* User.cpp: C source, ASCII text User.h: C++ source, ASCII text User.o: ELF ...
7
votes
1answer
92 views

Normal looking text file, detected by file as ASCII Pascal program text

I have a "normal" looking text file (contains english sentences) which is getting detected by file command as ASCII Pascal program text. How does Pascal program text differentiate itself from normal ...
2
votes
0answers
68 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 ...
0
votes
0answers
32 views

Storage Formats for Flat File DB

Currently I use a flat file database with find -type f -ls to store information for about 400GB of files. I'd like to store also the md5sum/sha[1|256]sum of the files. Because the files are often ...
4
votes
3answers
38 views

Local Account Creation Date

For compliance purposes there is the need to fetch information regarding local (user and non-user) accounts creation date on UNIX machines. Is there any way (even if it's not the most reliable or ...
2
votes
1answer
35 views

Copy file from USB drive to a desktop loaded via a LiveCD

I have booted my computer using a LiveCD and want to copy a file from a USB drive to the LiveCD loaded desktop. I want to copy a file from the USB drive to the desktop environment in memory, which ...
14
votes
2answers
1k views

How do I “cat and follow” a file?

A file is being sequentially downloaded by wget. If I start unpacking it with cat myfile.tar.bz2 | tar -xj, it may unpack correctly or fail with "Unexpected EOF", depending on what is faster. How to ...
0
votes
1answer
15 views

remove special character from files in directory

I need to remove special characters from all .htm files in a directory. Ideally I need to keep the file name but if I have to I can copy each file to 1 or something like that. Here is the command I ...
2
votes
1answer
42 views

Create directory using filenames and move the files to its repective folder

I have a folder with around 150 text files. I would like to create folders in the name of the 150 files. After that I would like the text file to be moved to its respective folder. Example names of ...
2
votes
0answers
57 views

ls does not show a hidden file (OS X)

I am using lsof to view the list of open files. One such file that it displays open is : Google 3864 malaykeshav 46u REG 1,1 470455334 32578671 ...
29
votes
7answers
2k views

How can I trick a process into thinking a file doesn't exist?

I have a program that stores its settings in ~/.config/myprogram that I use both interactively and with a batch queuing system. When running interactively, I want this program to use my configuration ...
2
votes
1answer
24 views

move the search content to different directory

I am on Oracle Solaris. I am using: grep "searchstring" filename.* above command returns my search result. Now I want to move the all the files in above search result (all the files not the ...
3
votes
1answer
47 views

Can't create a+r file

Using Debian I am unable to create files that by default has read permission for all users. For example: # umask 0002 # touch test # ls -l test -rw-rw----+ 1 user user 0 Jun 25 18:18 test Is there ...
1
vote
2answers
36 views

Permissions under a 700 (rwx------) directory

If a directory /foo/bar/baz has 700 (rwx------) for its permissions, thereby making it inaccessible to all but its owner (and the superuser), does it matter what the "group" and "other" permissions ...
1
vote
1answer
32 views

Set file creation date to its modification date on OSX

I need to batch edit file creation date (some stupid audio recorder set the file creation date to UNIX epoch and the correct recording date in the modification date) to set it to the files ...
3
votes
1answer
54 views

Monitoring filesystem activity

Say, I have a program, and I want to monitor its filesystem activity (what files/directories are created/modified/deleted etc.) This program may be capable of spawning further processes, and thus, I ...
3
votes
2answers
49 views

Comparing files in unix columnwise

I want to compare two files with same number of rows and columns with records in same order. Just want to highlight the differences in the column values if any. file A: 1,kolkata,19,ab ...
4
votes
4answers
206 views

Redirecting Output of print to multiples files in awk

I want to print same lines to 2 different files. What I am doing right now is: print ID[i]" "Value[i]" "TS1[i]" "TS2[i] > "file1.txt"; print ID[i]" "Value[i]" "TS1[i]" "TS2[i] > "file2.txt"; ...