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

learn more… | top users | synonyms (1)

11
votes
4answers
588 views

How is a directory a “special type of file”?

I am reading this Unix tutorial and came across this quote... We should note here that a directory is merely a special type of file. ...but no explanation or details are provided. How is a ...
0
votes
0answers
6 views

Map Home to External Drive

Whereas I have my OS (in this case, Elementary OS Freya) installed on my non-partitioned internal hard drive, I have an external hard drive with /Documents, /Downloads, /Movies etc. where I store all ...
7
votes
2answers
315 views

How to store a large folder in a single file without compression

Sorry if this is a stupid question, but I want to take a 78gb folder and store it in a single file (for upload into a cloud service), as if I am compressing it in an archive, but I don't want any ...
3
votes
3answers
81 views

Remove passphrase from private key and set specific file mode

If I set a passphrase on my private key like so: openssl rsa -des -in insecure.key -out secure.key and I remove the passphrase like so: openssl rsa -in secure.key -out insecure.key then my ...
1
vote
1answer
17 views

File with a no-atime-updates “A” attribute still updates atime. Why?

$ stat file_1 | tail -n 4 Access: 2015-04-16 21:48:42.675095130 +0200 Modify: 2015-04-16 21:48:42.675095130 +0200 Change: 2015-04-16 21:51:31.844300132 +0200 Birth: - $ lsattr ...
2
votes
1answer
49 views

How to split file and save parts to multiple locations?

How do I split a large file into multiple smaller chunks and write each part of it into separate locations? split command seems to only output all the files into one location. The context I need to ...
-1
votes
1answer
37 views

How to remove duplicate lines from file? [duplicate]

I have file for example 'a' aaa aaa bbb ccc ccc bbb ddd After executing uniq a c i get file 'c' aaa bbb ccc bbb ddd How to delete duplicate bbb lines?
1
vote
1answer
12 views

File corruption using rsync, multiple rsync processes, moved/renamed source file

I'm encountering some file corruption when using rsync (that is, the file contents do not match the source file). I can understand the file becoming corrupt if it is being written to while being ...
4
votes
1answer
36 views

Find the files between two folder dates in linux?

I need to find the folder names along with the file names which has my string in their contents. I am in this directory "/data/queue/data" and I have lot of folders in the same directory and inside ...
1
vote
1answer
19 views

How to undo and revert an accidental `7z e`

I accidentally typed 7z e archive.7z and all the files ended up in my home directory when I wanted to extract them in a subfolder. How can I clean the mess and remove all those files?
3
votes
4answers
468 views

Is is possible to modify a file in a read only directory? [duplicate]

I have already read: Is there a way to modify a file in-place? I am curious if there is a way to modify a file in place using a command that will not create temporary files. Let's say I create a ...
0
votes
1answer
40 views

enable to write to file inspite we remove all file permissions

something isn’t clearly for me when I remove all permissions from file as chmod 000 I expected to get permissions denied when I write to file but still I can write to file as the following example can ...
2
votes
2answers
38 views

Make rsync move (not copy) files on local file system

Can I make rsync to move large amount of files instead of copying them when on local filesystem? I would like it to behave like improved mv command. I know about --remove-source-files option but ...
2
votes
3answers
95 views

remove all instances of _000 from multiple files

Had to recover my music library from a HDD which died.... got everything I wanted but all music track names have _000 added at the end. I really don't fancy going through 8000 individual music tracks ...
0
votes
0answers
29 views

Tar corrupting file attributes and skipping directories

While creating tar archives for backup purposes with 'large' numbers of files (200+), I have been repeatedly running into the following errors: tar: some/path/file.xyz: Cannot stat: Invalid argument ...
0
votes
1answer
60 views

Is there a way to use sed or awk to filter data inside a zipped file? [duplicate]

Is there a way to use sed or awk to filter data inside a zipped file? When I run a sed or awk command and send to stdout the file created is 0 bytes.
0
votes
3answers
45 views

copy the contents of a variable in a text file

I know this is a stupid question but I want to know how I can put the contents of a variable in a text file. This variable is a string that I want the code with the base64 command.But this command ...
3
votes
1answer
199 views

How can I see a file's historical modification times? [duplicate]

stat outputs a file's last modification time. How can I see a list of all the times a file was modified? For example, I'd like to edit a file 5 times, and see 5 modification times.
4
votes
5answers
354 views

Script tries to create files even though it shouldn't have to?

I have a folder which contains some folders, these folder are moved very often so I made a script to see if they exist, and if not then create them. This is what I did to (which I though would) ...
0
votes
1answer
52 views

Delete files older than X days +

I have found the command to delete files older than 5 days in a folder find /path/to/files* -mtime +5 -exec rm {} \; But how do I also do this for subdirectories in that folder?
1
vote
1answer
44 views

How to copy a directory with only specified type of files?

I got a git directory with plenty of python files(and some special file like .git). I'd like to copy only these python files to another directory with the directory structure unchanged. How to do ...
3
votes
3answers
51 views

Traverse, copy & transform file names

My issue: I need to copy log files, all with identical names, but stored 1-deep in subdirectories, and change their names. I'm copying from the a folder called Logfiles which contains a bunch of ...
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
52 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
16 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
30 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
35 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
52 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
75 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
47 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
32 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
13 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
140 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
1answer
56 views

Expect Scripts - Reading from Files and Accepting User Input

How can I write an "Expect" script to: 1) 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
35 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
33 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
35 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
414 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
33 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
23 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
155 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
70 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
65 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
89 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
54 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.
2
votes
3answers
58 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
38 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
45 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
33 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
25 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 ...