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

learn more… | top users | synonyms (1)

2
votes
2answers
162 views

Any way in Bash to write to a file every X seconds without closing it?

The hardware watchdog on my system needs a 0 written to /dev/watchdog at less than 60 seconds interval or it will fire. The file handle must be kept open however or the watchdog is then disabled. ...
5
votes
2answers
61 views

How to backup dir structure ignoring files & dirs without read permission

Any ideas how to back up a directory structure for which there are some files and/or directories for which you do not have permission to read? I'd like to just ignore those, without backup (tar? jar?) ...
2
votes
1answer
52 views

what is the original command to create a file? [closed]

we can create a file by a lot of commands: cat > foo.txt echo 'This is a test' > foo.txt touch foo.txt vi foo.txt (or any text-editor) my questions are: What is the original command to ...
3
votes
2answers
291 views

Read all files in folder and subfolders - progress and size

Command I have is: time find . -type f -print -exec cp {} /dev/null \; This command finds all files in current folder and subfolders, print the name of each file and copy each of them to /dev/null. ...
1
vote
1answer
47 views

Emacs, complete list of color “keys”

If you want to customize the colors in Emacs, specifying them in the .emacs init file, without installing any extra package, and without using a pre-made theme, something like this seems to work: ...
2
votes
2answers
108 views

inotifywait different action on file or dir

I'm trying to make a inotifywait script take different actions for files vs folders if it sees a close_write flag being raised in the watched directory, but cannot seem to get the checks working. In ...
1
vote
2answers
34 views

List of files accessed by application

I want to install propertiary AMD driver but I would also like to know which files were created/changed by installer. Is there some application which can observe (probably by inotify) which files were ...
2
votes
2answers
83 views

how to show total files size in a folder by filtering extension without showing each file size

du -hc *zip shows me total size of zip files in a folder, but it shows also every single file size of the folder. I only need total size. Is there way to show the total size of a folder without ...
6
votes
5answers
698 views

Is there a way in Linux to have one non root user check if another non root user has permissions to a folder / file?

The scenario is this - I have a command line program that might not run as root, part of the requirements is to warn if another user has write permissions to some folder / file e.g. I'm running as ...
0
votes
1answer
47 views

Execute scripts without decrypting them

I have a set of scripts (bash, ruby, python) and want to put everything into a container like file so I can deploy this container on a lot of servers. This scripts need to protect from accessing other ...
1
vote
4answers
128 views

How do i get the latest file from a list of files in a particular directory

I need to get the latest file from a list of files in a particular directory. When I run the script the first time I've copied the list of files in a particular directory to another directory. From ...
3
votes
3answers
319 views

Shell script to replace string in multiple files within selected directories

I created the script below which takes the path of a single directory and replaces search string in all the files within that directory. I would like to enhance this script in such a way that it can ...
2
votes
2answers
127 views

How linux know the type of the file it is dealing with? [duplicate]

In windows the OS know the type of file by using extension: exe,doc,ppt,pdf .... etc In Linux as we know that the extension is useless. My question is how can Linux know the type of file it is ...
0
votes
1answer
47 views

Partition is out of space

When I was trying to resolve the issue as seen in this question, I figured out that a specific partition is out of space. I have a specified folder which I allow all ftp uploading of multimedia files ...
2
votes
0answers
28 views

Image set compression

Is there a good open source (not exclusive to Linux) for compression of a set of similar images? I have thousands of documents scanned but I do not access them often. The documents are forms, with ...
-2
votes
2answers
41 views

Clarification on permissions with GID & UID in UNIX

If Test1 & Test2 are users, then Test1 : UID : 501, GID :501, groups=501,100 Test2 : UID : 502, GID :502, groups=502,100 What will be the correct option from below and explain how? Test1 ...
3
votes
1answer
144 views

Automatically detect when a file has reached a size limit

I would like to send an email when a file reach a certain size limit. The only way I thought of doing this is by doing a cronjob which will check the file size and send the email if the file is ...
1
vote
1answer
47 views

How to Test if a file has characters in it?

So i have a part of this code and U want it to output "No such player" if only the names file is empty, i've tried using the test -s command but it gives an output of 0 even if the file is empty or ...
1
vote
1answer
61 views

How to install a .bin file that gives the error that it needs more space in /tmp?

Here is the error: ~]$ ./jdev_suite_121200_linux64.bin 0%....................................................................................................100% Not enough disk space in dir ...
3
votes
1answer
84 views

How unique are checksums?

I have a lot of files I need sorting; and sadly there are many files with the same name but different content, and there are the same content with different filenames. I'm thinking about using md5sum ...
0
votes
1answer
31 views

Why does “file foo.css” and “file bar.css” have different outputs?

For example, executing file styles.css outputs: styles.css: asssembler source text whereas file bar.css outputs: bar.css: ASCII text Even better, is there a way to convert my file styles.css to ...
1
vote
1answer
54 views

linux command stuck

I have strange problem on my Linux machine When I do the following simple command chmod +x /tmp/file chmod is stuck and not returned the prompt what could be the problem? the same issue when ...
1
vote
1answer
42 views

With mv, possible to put a time dependence on files mv'ed?

Let's say there's a specific time and date I have in mind. All files last edited before this date I want to keep in the directory but all files that have been edited since this date I want to mv ...
3
votes
1answer
66 views

Two users with different permissions on same directory

Is it possible to give two users different permissions on the same directory? I want to use it for ftp: userFull gets R+W and userLim gets only Read, depending on who logs on. Im getting stuck on the ...
1
vote
1answer
115 views

Unreadable backup directory on a USB drive

The title pretty much sums it up. I was editing a script I wrote some time ago to automatically backup the contents of my Raspberry Pi SD card, and in the course of editing, I missed a "/", and so ...
1
vote
1answer
38 views

Is there a command which creates a temporary file containing the arguments passed to it?

I can paste the contents of a file into a command using cat and backticks: ls `cat filenames` Is there a way to do the reverse - to turn a string into a (temporary) filename? gcc -o cpuburn `uncat ...
2
votes
2answers
136 views

find the single largest file

We host a share of size 4 TB. How efficient is it to find a file with highest size. Usually we use: du -ak | sort -k1 -bn | tail -1 and it is not easy to scan through a share of such huge size and ...
7
votes
6answers
509 views

How can I get a specific line from a file? [duplicate]

I want to extract an exact line from a very big file. For example, line 8000 would be gotten like this: command -line 8000 > output_line_8000.txt
4
votes
2answers
130 views

Is it possible to prevent files created being world-readable?

Assume a user uid=1000 and guids=1000,33,277 is allowed to create a file in the folder /files/. Is there any way I can prevent that the this user allows others to read the file (which are not at least ...
1
vote
2answers
88 views

Create file with specific formatting from directory contents

I am using Solaris and csh. In $home/test there are five files: a.txt, b.txt, c.txt, d.txt and e.txt. If I run % find $home/test/ -type f -print > ../filenames.txt that file will look like: ...
1
vote
7answers
816 views

Can grep be used for searching files with some string in their names?

I understand that grep can only be used for searching for files which contain a string in their content. Can it be used for searching for files with a string in their names? I read the manpage, and ...
0
votes
0answers
57 views

How to mount multiple iSCSI images too loop

I have to mount iscsi images to loop. Yesterday someone with a similar problem asked that already. The difference is, my iscsi image is splitted into 5 parts. ls -la insgesamt 4718592004 -rw-rw-rw- ...
4
votes
1answer
80 views

mapping a split file to /dev/loop0

I have a iscsi disk 2TB large. I make backup of that disk every week. The backup script copies the image of the whole iscsi disk into a file on my NFS. Unfortunately, it does not copy the image in one ...
4
votes
2answers
72 views

setting default permissions with setfacl

I am trying to set default permissions on my directory structure using acl. I would like to have following default permissions for directories and for files respectively: drwx--x--- -rw-r----- but ...
0
votes
1answer
76 views

Move Data from Partition to Partition on Same Drive

Moving data from one drive to another is slow. Copying data on a drive to it's self is slow. Moving data from one drive to it's self is fast. If I'm moving data on the SAME drive but a different ...
1
vote
2answers
163 views

Find when the file was closed in Unix

I know ls -l will give the modified time of file, but it is giving the time when the file was opened, not closed (using Ctrl+D or something) Please tell me how to find the time of file closed ...
0
votes
0answers
75 views

Strange issue with xml_split in Linux

I am using the code xml_split from https://metacpan.org/pod/distribution/XML-Twig/tools/xml_split/xml_split to split a huge XML file. I am facing a strange issue with this. First, I tried the ...
1
vote
0answers
51 views

How do I make get-iplayer produce watchable quality without huge filesize?

Summary findings: I'm using get-iplayer v2.82. The files I produce on hard drive are all mp4. I've discovered the following (downloading same TV program in both cases): Using --modes=flashstd and ...
2
votes
1answer
150 views

allow user access via ssh to /var/www/

Context: I am creating a gitolite3 hook for a specific repo, which contains some logic and css foo of my website. so what essentailly happens is Content under /var/www/nginx/ looks like: ...
3
votes
1answer
92 views

Help with giving group permissions to other user's files

I'm a linux beginner using Debian 7 and have created a new user (a website) with an htdocs directory like this: $ sudo adduser website $ sudo mkdir -p /home/website/htdocs $ sudo chown -R website ...
2
votes
1answer
95 views

Can one directory be owned by two groups?

Can one directory be owned by two groups (RHEL 6.2)? I have created one directory: mkdir /opt/shared, then I created two groups: groupadd sales groupadd marketing I added manually to each of ...
3
votes
1answer
54 views

Does du or df perform caching?

I was wondering if there is any caching done with these utilities. I assume not, but not positive. Are there any typical similar utilities that do use caching to speed up results on subsequent runs? ...
1
vote
2answers
32 views

Store a file for all users within a group

If user A is member of group foo, is it then possible for A to share a file for all members within foo without root permissions? chown foo:foo file Is not permitted without privileges. A can say ...
5
votes
6answers
580 views

About the .file and ./directory confusion

This is a dumb question, but I recently moved from windows to linux, and I see one strange thing: ./configure or nano /something/something2 Is this something2 a file? It looks like a directory, ...
6
votes
2answers
321 views

Copying one file to multiple directories

I have a file that I want to copy to another 60 directories. The best way I can think of doing this is by making a bash script that has instructions to every folder like this: cp script.sh ...
2
votes
1answer
89 views

Move extension-less files with mv

I have a folder with images(png, bmp, jpg) and extension-less files. I cant figure out how to move only the extension-less files. They are all random numbered files.
1
vote
1answer
61 views

grep file from file

What is the fastest way to grep -v a file against another one, both line by line. does grep support this ? Or should I use it on two for loops ?
0
votes
0answers
88 views

Editing metadata with bash

I have a bunch of photos(jpeg, bmp, png) that I have arranged in such a manner that the metadata is in html form in a separate file. I would like create some script to read this html file and edit ...
5
votes
4answers
305 views

Delete all files in a directory whose name do not match a line in a file list

I have a directory with 1000+ files. In a text file, I have about 50 filenames, one per line. I'd like to delete all the files in the directory whose filenames don't correspond with an entry on the ...
0
votes
0answers
45 views

Unable to make file system writtable no matter what

I have a flash card SanDisk of a camera which I plug in into my computer: $ lsblk mmcblk0 179:0 0 3.7G 1 disk └─mmcblk0p1 179:1 0 3.7G 1 part $ mount /dev/mmcblk0p1 on ...