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

learn more… | top users | synonyms (1)

0
votes
0answers
45 views

Directories and files changed to unknown type [duplicate]

After breaking my Debian jessie system with the mistyped command: # chmod -R 0644 / now I am using a live CD to backup my data but all the files and directories are of unknown type now and ...
-1
votes
1answer
59 views

Generate a tarball or (.tar.gz) of the recently modified files in the directory

As the title says, I need help creating a linux script that generates a tarball or (.tar.gz) of all the files in the directory passed in as an argument to the script and have been modified in the past ...
0
votes
0answers
35 views

Moving Informatica data(directories) from one unix server to another unix server

Can we migrate directories from one unix server to another unix server, without the need of installation of Informatica softwares on the new unix server? If yes, then will there be any change in the ...
0
votes
1answer
34 views

File permissions categories

So I am a little bit confused with File permissions categories. So here is what I do understand and correct me if I am mistaken. For every File , there is an Owner (one user) which have a symbol u ...
1
vote
1answer
41 views

Recursively list files containing an underscore in the file name

I have a large directory with tons of files and subdirectories in it. Is there a way to recursively search through all of these files and subdirectories and print out a list of all files containing an ...
2
votes
1answer
101 views

Using find and sed to copy 20th line of many files into one file

I have a folder called "PKA1" Within this folder I have several folders that look as: 1eV, 2eV .... 30eV Within each of these I have subfolders I have a file called PKA.dump I want to copy the ...
1
vote
1answer
94 views

string search using awk

I have file-1 which has list of transaction id . File -1 201503301616|9b8791b3-f860-409f-aad0-24debf834c1b|10.233.18.29.677220869928387637969 ...
1
vote
1answer
51 views

Tree with directory name and filenames

I run with tree 1.7.0 tree -PF dat It gives . ├── 0deg/ ├── 105deg/ ├── 120deg/ ├── 135deg/ ├── 150deg/ ├── 15deg/ ├── 165deg/ ├── 180deg/ ├── 210deg/ ├── 240deg/ ├── 270deg/ ├── 300deg/ ├── ...
0
votes
1answer
43 views

How to get new created (not change or modified), & removed files in last 24 hours

I want to write one script where I need the below function : List all the files which are created in last 24 hours. If I give the find command with ctime option then it list all files which are ...
-1
votes
1answer
15 views

how to disable folders/files under root folder in RHEL?

I want to "disable" listing of folders and files under root folder in RHEL. So when I login to my application nothing should be visible in root folder.
5
votes
1answer
182 views

Is it possible to create a non-empty file without write_close and rename event?

The reason why I am asking is because I'm using iwatch (not to confuse with a gadget device) to watch for filesystem events (in my case - file creation/renaming). What I cannot explain is this log: ...
0
votes
2answers
138 views

Expect Scripts - Reading from Files and Accepting User Input

How can I write an "Expect" script to: iterate over a list of IP addresses and log in to each to perform commands (like in a BASH for loop). Right now I just copy/pasted the few lines that are my ...
0
votes
1answer
40 views

How to set path in cronscript

I am running a cronscript like: */45 * * * * /path/to/php /path/to/file.php it creates a file and put on home directory; But I want to create this file in my desired path like: */45 * * * * ...
2
votes
1answer
55 views

How to list directory/file sizes in general on UNIX-like systems?

In general on a UNIX-like system (Linux, AIX) the following can list file/directory sizes in MByte, even if the filename is starting with a "-": du -sm -- * 2>/dev/null | sort -nr | head -25 ...
1
vote
1answer
76 views

How to use convert command with bash to resize all images in a given directory?

I want to resize all PNG files in ~/somefolder/ whose filenames are NOT started with tn_ to 50% of its original size and rename the output file with a tn_ as its prefix and its original name. I know ...
5
votes
2answers
438 views

How are mutually untrusted app's files protected in Linux

I am running a Ubuntu Linux machine. When I run applications written by different vendors like Chrome and Firefox, I notice that they all are running with my uid. But if that's the case, any file they ...
2
votes
1answer
55 views

Why does chmod succeed on a file when the user does not have write permission on parent directory?

I am trying to understand file/dir permissions in Linux. A user can list the files in a directory using cd test ls -l Even if the user issuing above commands does not have read, write or execute ...
-1
votes
1answer
46 views

Copy files from find command [closed]

I am trying to copy all *file.log files found using find. The problem is all files are named the same and it is only copying over one file. I need to find a way to rename the files in the command or ...
5
votes
2answers
182 views

How can I list files of which no symlinks exist?

I have a large "myfiles"directory full of miscellanous documents and do not want to modify its structure. I therefore created (several) other directories for each class of documents. For example I ...
2
votes
2answers
78 views

Print file contents and delete the printed content* from the file

In Linux, from a bash shell, how can I print the contents of a file and remove the content I just printed content from the file? I have a program writing texts to a file repeatedly. On a Linux shell ...
2
votes
4answers
229 views

Does the inode change when renaming or moving a file?

in PHP the fileinode() functions returns the inode of a file. I was wondering if I can use it to determine if a file was renamed, moved or modified. I did some tests and it seems the inode stays the ...
5
votes
6answers
142 views

Exclude directories in locate search

A search with locate finds paths in the filesystem. Often, you know a priori you are interested in either files only, or directories only. A 'locate' search often returns many results. It would be ...
2
votes
4answers
80 views

input file stream to command

How is it possible to send a file stream to this command instead of a file? /usr/local/bin/wkhtmltopdf --title "$SUBJECT" -q $SOURCEFILE $OUTPUTFILE The file stream is from a string in PHP.
3
votes
3answers
80 views

Can a file be edited with the 'write' permission on it but not on its parent directory?

Suppose the owner/user doesn't have the write permission on a directory but he has it on a file under it. Can the file here be edited or not? If yes, is there any situation where the file cannot be ...
0
votes
0answers
46 views

Touch a file and give it an icon image via command line

Imagine this situation: for a given task, at some point of it, I should be able to create an empty file, which I can achieve by touch file.ext on the command line. However, if I touch a .jpg file, and ...
0
votes
1answer
61 views

Search a file for a string in multiple directories

Can someone please help me with a command to search a file for a string in multiple directories? I am searching for the VIP in httpd.conf in multiple httpd instances. I am using: find ./ -name ...
1
vote
1answer
66 views

Can I restrict sudoer nopasswd to directory?

Maybe I should rephrase - what is the most secure way to accomplish my needs? Details I am using WinSCP to modify my Apache document_root. The directory /var/www/html has an owner and group of root. ...
0
votes
0answers
29 views

backup without closing programs that are opening files for editing, and detect unsaved open files?

Is it possible to do backup without closing programs that are opening files for editing? I would like to do backup without closing programs that are opening files that I am reading or writing. I ...
0
votes
0answers
24 views

Cancel removing a directory, and want to find out what have been removed

I was removing a directory by rm -r mydir and cancelled it in the middle. How can I find out what have been removed under the directory? Does remove a content of a directory change the timestamp of ...
2
votes
2answers
84 views

vim: how to trace back all changes done to file during the day

Does anybody know how to setup vim (the text editor) in such a way to make it possible to trace back all the changes done to a file within a day? I need it for the cases when I have accidentially ...
0
votes
1answer
39 views

Unable to delete a file on different user's directory

I've two user's abc & xyz and the user abc has been added to the group xyz via usermod -a -G xyz abc and here the file permission on home directory of xyz i.e /home/xyz: drwxrwxr-x 2 xyz xyz ...
1
vote
1answer
257 views

Difference between owner/root and RUID/EUID

I am relatively new to the concepts mentioned in the question and reading about them from different sources only makes them more confusing. So this is what I understood so far: When we are given ...
4
votes
1answer
47 views

Recovering data written to file that moved

I have a Python daemon running on CentOS that opens a file at the beginning of a session, and keeps writing to it. A cronjob however, gzipped the file that was being written to, and so the file moved ...
3
votes
2answers
121 views

How to list files on terminal so that we can see the file types such executable, ascii etc?

I have been trying to list files in directory using ls and passing it different options. Does it have the ability to list types of files as well ? I want to know which ones are executable , ...
2
votes
1answer
44 views

Why am I seeing a number as owner / group instead a name?

CentOS 6.x / OpenVZ Recently my VPS provider moved my OpenVZ container to a new server. After that move, I've noticed that files/directories for one of my user accounts show an odd owner / group. ...
2
votes
1answer
24 views

How to determine the only additional file in otherwise two identical listings?

I have done a listing of the device folder two times, one time without the sd-card in the slot and one time inserted, the system automatically adds one file in the device folder. $ ls /dev | wc -l ...
2
votes
1answer
79 views

How to change only the mtime of a directory?

I am trying to change just the mtime of a directory by adding files or sub directories but that changes the ctime of the file too. Is there any way to just change the mtime without affecting the ctime ...
1
vote
1answer
36 views

How to move directories based on the output of rhash (CRC32 check of .sfv) with bash/perl?

My idea, is to move the CRC-check OK folders (albums) into a lets say "complete+CRC_OK" folder with a script once per day in cron. I would need to put the rhash command in a loop with number of ...
0
votes
0answers
127 views

How can I let a application/user account only create and update a log file (no read permissions) in Linux

I'm attempting to setup a fairly restrictive Apache Tomcat installation on CentOS 6.6 and am stuck on file permissions for the log folder. The tomcat folder and all it's sub-directories are owned by ...
2
votes
2answers
55 views

How does one permissibly access files on non-booted system's user's home folder?

I have a dual boot system with Mint 17.1 and Centos 6.6 I want to access a file in my CentOS user's home directory from Mint. (I cannot boot CentOS right now.) What is a clean/standard method for ...
0
votes
2answers
63 views

How can I quickly find the 20 most recently modified files on Mac OS X (instead of using Python)?

Of course it's possible to take the output of find . -type f | xargs ls -l and pipe it to a Python script that would sort the lines and output the top 20. But is there anything faster than that?
2
votes
3answers
43 views

Set group permissions as owner permissions

I need to set the same permissions of owner to group recursively to all elements in a directory.
1
vote
0answers
46 views

How to move /usr folder and replace it with saved copy [duplicate]

If I made a backup of /usr with: # cp -r /usr /usrRESERVE1 how can i switch it back after some time: 1# mv usr usrRESERVE2 2# mv usrRESERVE1 usr second command will not work because mv is inside ...
3
votes
2answers
91 views

save the number of files only in a specific folder

I'm using this script to save the number of files in a main folder, but it also counts the subfolders inside that main folder. nfiles=$(ls -1 /home/userA/mainfolder | wc -l) Any advice how I can ...
1
vote
2answers
55 views

How to copy only files in a specified directory to another folder

I'm trying to copy only the files from one directory (not including folders or any files in its subfolders) to another location using cp /media/d/folder1/* /home/userA/folder2/. It is copying the ...
0
votes
0answers
100 views

Why is moving file within an ext4 partition so slow?

The short question is why is a move operation, moving within the same ext4 partition taking longer than a copy of the same files from a different drive? The longer description of the scenario: I ...
1
vote
1answer
36 views

How to test whether a file is a font file

I have several thousands of automatically saved web-pages, proceeding from different sources. Many of the web-pages have embedded fonts in files like *.woff, *.eot, *.ttf, and *.svg. I'd like to ...
1
vote
1answer
310 views

Reading the contents of an ELF file (programmatically) [closed]

I am trying to retrieve the contents of an additional section within an ELF binary. At this point, I'm using the following code to retrieve the name of each section: #include <stdio.h> #include ...
2
votes
0answers
31 views

How to sort files by their dates into timestamped folders? [duplicate]

I want to sort about 2500 images every day into folders with a timestamp. So far I have this script but it's not working.... for x in *.jpg; do d=$(date -r "$x" +%Y-%m-%d) mkdir -p "$d" mv -- "$x" ...
1
vote
4answers
74 views

Delete all files in a directory

I have a directory which includes some files and some folders containing other files. I'm trying to remove these files in the main directory without touching the folders or their contents. I'm using ...