Logical entities that contain data in a filesystem. Use this tag if your question: is about programs that create files (e.g. gzip, tar, zip); deals with characteristics of files (permissions, size, path/location); or is about management of files (renaming, listing, moving, removing). For operating ...

learn more… | top users | synonyms (1)

1
vote
2answers
32 views

Install the content of a folder into another

I'm trying to write a Makefile to install the content of my folder into another on the system. I would like to keep the same directory structure, like this. localfolder ├── a └── b ├── c    ...
4
votes
2answers
73 views

Is it possible to find files created between two specific times while ignoring the dates?

I have a time lapse of thousands of jpgs and would like to know if its possible to list only the shots taken during daylight hours? So it's not about listing the files between two dates, but listing ...
2
votes
1answer
85 views

Move all files into subdirectories named after beginning of file name

I have a directory that contains quite a lot of files with names made up of 8 random letters, numbers, _ and -, e.g.: 0dckGYH5.jpg 32Pz5-WQ.png 32_17pxH.png Hsf4BQW9.jpg xh-fa3Nu.gif zYtBEaKA.png ... ...
1
vote
2answers
49 views

Scan for file changes in some directories once every 6 hours

I've had some security issues lately and as I can't be totally sure that my code is secure, I have been thinking about scanning some folders and get notified when a file is changed or a new file ...
1
vote
1answer
922 views

Apache created files and its permissions for CentOS 6.x

In short, I have an authenticated HTTP-POST that: posts a jpg image (created as 666 apache:www) into /directory1 (777 ftpuser:www) creates /directory2 (created as 666 apache:www) in a 777 ftpuser:...
3
votes
1answer
371 views

Delete all files with executable permission in a directory

I am in need of deleting all executable files from a directory. My directory contains some configuration files and executable files, and I need to delete all executable files that I don't want. For ...
1
vote
1answer
27 views

Event dispatcher in bash (Ubuntu Gnu/Linux) [duplicate]

Are there any methods or bash tools that can observe some events (such as creating a folder) and then do another actions?
8
votes
2answers
2k views

How to sync two folders with command line tools?

Having migrated to Linux from Windows, I would like to find an alternative software to Winmerge or rather learn command line tools to compare and sync two folders on Linux. I would be grateful if you ...
6
votes
6answers
3k views

Find images by size: find / file / awk

I've been trying to find png image files a certain height (over 500px). I know that file will return image dimensions. Example: $ file TestImg1a.png TestImg1a.png: PNG image data, 764 x 200, 4-...
2
votes
1answer
39 views

Search for files inside multiple subdirectories and zip directories [duplicate]

I need to extract more than 2k files from 1000 folders..the problem is, each folder has a zipped folder inside and inside this folder, there is another folder called "fileholder" which contains some ...
1
vote
1answer
36 views

Is there a way to see a time stamp or any evidence of when/if my usb was accessed in Linux?

Is it possible to see or figured if someone accessed my USB or copied any file from it while I was not at home?
1
vote
4answers
99 views

/bin/ls: Argument list too long

I am a biology person and running a program named autodock. I have some files from ZINC library in .mol2 format. As per requirement I need to split this files with the csplit command and I received ...
1
vote
4answers
68 views

How do I delete file by filename that are set as dates?

I want to delete file not by date access or created, but by filename. The filenames will be dates and I want to have a cronjob run once a week that will purge filename dates older than 7 days. I could ...
5
votes
0answers
55 views

group member unable to write to a group-writable file with reiserfs and extended ACLs

Users vi and rust share group rust and want to use some file in shared manner. rust$ ls -l myfile -rw-rw-r-- 1 vi rust 0 May 30 03:48 myfile rust$ stat myfile | grep Gid Access: (0664/-rw-rw-r--) ...
0
votes
3answers
58 views

Delete last line of gz file

I need to delete the last line of gz file without uncompressing. The file has 500 lines. How can I do that? I have tried: gzip -dc "$files" | tail -500 | gzip -c > "$files".tmp But It doesn´...
0
votes
1answer
54 views

Deleting duplicate file with exactly same filename but different sizes

folder_1 ./a20160606_000000_000021.txt 5KB ./a20160606_000000_000062.txt 5KB ./a20160606_000000_000531.txt 5KB ./a20160606_000000_004521.txt ...
4
votes
3answers
82 views

Shell script to separate and move landscape and portrait images

I have a directory of jpg images. Is there a shell script (bash or zsh would be acceptable) that would move all landscape images into a directory, and all portrait images into another directory?
1
vote
1answer
37 views

Using crc32 to find if files were harmed or damaged

I have a directory with a content. To ensure nothing will get lost with copying I compressed the directory and now I have a dir.tar.gz file. The copying still troubles me and the files are damaged so ...
1
vote
1answer
31 views

Watch/View file contents but no new lines added

This post 'Output file contents while they change' is similar but the answer doesn't work for my case. Tail -f doesn't seem to refresh the output when the file's size doesn't change or when there are ...
3
votes
2answers
11k views

Monitoring file locks, locked using flock

I would like to get a list of pid's which hold shared lock on /tmp/file. Is this possible using simple command line tools?
1
vote
6answers
93 views

How to check what file content changes, not the atime, mtime, ctime in Linux?

Is there any ways to find out what file content has been modified or added in Linux. I am aware of the atime,ctime,mtime. Say I created a script "myscript.sh" and somebody changed some content of it ...
0
votes
1answer
22 views

Bash - How can I make selection menu of zip files based on how many zip files in a directory?

I am doing a theming tool script. I want to make a selection menu of zip files (zip file contain theme) in a directory, then users will choose a zip file they want to install Example: in /theme/...
12
votes
5answers
6k views

How to run a command when a directory's contents are updated?

There is a directory A whose contents are changed frequently by other people. I have made a personal directory B where I keep all the files that have ever been in A. Currently I just occasionally ...
6
votes
5answers
9k views

Constantly check if file is modified bash

I have a file called file1 I want in a script, whenever there is a change in it, do something, a beep sound actually. How do I do that ¿? Thank you in advance
1
vote
3answers
110 views

Find Directory if Number of files is over X

Am wondering if someone can advise on the best way to do this. In my Web Dir is around 100 folders; each folder is a clientID. Within each ClientID folder is a Sub-Set of folders. In each subset ...
0
votes
4answers
61 views

Find folders that begin with the same string

I have more than 1000 subdirectories in a folder. Some of them begin with the same string and I want to find all directories where the first 5 characters of their name are also the first 5 of another ...
25
votes
6answers
47k views

File extensions for unix shell scripts

On wikipedia, the article for .sh says: For the .sh file extension type, see Bourne shell. How about other unix shells? I know that the shebang is used inside the file to indicate an ...
1
vote
2answers
193 views

How to sort files in a directory based on the index number of the file?

I have files like : 4-some file.mp4 1-another file.mp4 3-one more file.mp4 2-got another file.mp4 and so on. Using the command line to play the files in vlc using vlc * plays them in unsorted ...
5
votes
1answer
833 views

What does the “sticky bit” mean in NFS?

I'm trying to figure how is the sticky bit used in NFS v3. RFC 1813 says on page 22: 0x00200 Save swapped text (not defined in POSIX). What do they mean by "swapped text"? In "NFS Illustrated", ...
0
votes
0answers
19 views

Is it safe to delete '.journal~' files?

Our Apache installation is in /var/www on a CentOS 7.2 virtual machine. On occassion I run the following to ensure there are no unintended backups which could leak information to an attacker: $ sudo ...
2
votes
3answers
41 views

Find a specific file in the nearest ancestor of the current working directory

I'd like to find a way to find a given file by looking upward in the directory structure, rather than recursively searching through child directories. There's a node module that appears to do ...
3
votes
3answers
70 views

How can you move or copy specific files from a list of text files

So I have a directory of like 200 of the the following types of files: gre_6_c1_d34567.h3 gre_6_c1_d95543.h3 gre_6_c1_d42354.h3 gre_6_c1_d01452.h3 gre_6_c1_d23168.h3 gre_6_c1_435435.h3 The only ...
0
votes
0answers
19 views

Making a list of user-installed software using terminal [duplicate]

I have been wondering if it's possible to use terminal to make a list of all user-installed software. I have backed up all my files in preparation for an upgrade to ubuntu 16.04, and I used tree to ...
0
votes
1answer
19 views

Create directory from files and move files

I want to move files based on a specific pattern. I was working with this code, but it does not work well with the task. for file in *.fastq.gz do dir="${file%R*}" mkdir -- "$dir" mv -- "$file" "$...
4
votes
2answers
1k views

how to find out the full path of the command from the result of lsof -i

lsof is a great utility, just now started using it. lsof -i | grep smtp => this give the following result. httpd.pl 212548 global 3u IPv4 893092369 0t0 TCP server07.host...blah.....
2
votes
0answers
21 views

RHEL / SELinux - Apache unable to write to a directory it can write to [duplicate]

I have a RHEL 7 machine running an Apache web server with multiple virtual hosts on it. I've recently run into an issue where I am unable to upload media, e.g. images / pictures / video, to my machine ...
1
vote
0answers
24 views

Search multiple remote file systems at once?

Say that I've lost a particular file. I know part of the name, so I could use something like this to find it: sudo find / -iname "*filename*" ...except that I can't remember which device or server ...
42
votes
8answers
53k views

Find the total size of certain files within a directory branch

Assume there's an image storage directory, say, ./photos/john_doe, within which there are multiple subdirectories, where many certain files reside (say, *.jpg). How can I calculate a summary size of ...
-1
votes
1answer
437 views

How to find the htpasswd file created for SVN over Apache?

I setup subversion with remote access over apache. I created an htpasswd file for it, but now I've forgotten the filename and path. How can I find it?
0
votes
0answers
20 views

find lastly zipped file in a directory which has so many zip files [duplicate]

I am trying to make a script in that i need to execute a command which can give me the lastly zipped logfile(ex:my log file is going to be zipped toady so i need to place this file in script.likewise ...
1
vote
1answer
42 views

How to convert file from one format to another with file attributes?

I have an audio file named with attributes: BreakingNews.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz I wanted to convert it to in below format: BreakingNews.wav: ...
23
votes
8answers
42k views

Test if there are files matching a pattern in order to execute a script

I am trying to write an if statement to test whether there are any files matching a certain pattern. If there is a text file in a directory it should run a given script. My code currently: if [ -f /*...
1
vote
1answer
63 views

How do I rename files that have '|' in them?

I am using Fedora 24. I have tried many different ways to do this. I've tried it under a Windows VM with the folder in question as a shared folder. I've tried using the 'rename' command. I've ...
1
vote
1answer
68 views

Understanding file systems and mount points as seen from df and Nautilus

Forgive me I am a novice of Linux. I am trying to understand Linux file system. Let's say we run df command to show something about file system in my CentOS. I can see a LVM /dev/mapper/...
0
votes
1answer
33 views

how to keep oldest file in same directory

I had 2 directories "../in/" and "../temp/".My question is how to write bash script to keep the oldest file or directories in same ../in/ directory and remaining files or directories are moved to ../...
0
votes
0answers
33 views

Unrar specific files using wildcards

I want to extract only a specific file type using unrar. With unzip command I can extract all archives with a specific extension. unzip "$FileName" *[.txt,.TXT] How can I do the same with unrar? ...
2
votes
1answer
1k views

How to create gcov files for a project in a different dir?

I want to analyze code coverage datas. I want to create gcov files from OpenSSL (and from other projects), but I can only create them in the same directory of the project, and only for the files in ...
0
votes
0answers
20 views

How to prevent special group to delete files or folders?

Folder path: /var/www/html group name: "ftpusers" user: "admini" How to prevent from group "ftpusers" to delete files or folders in html folder, but allow them to create files or folders? User "...
3
votes
2answers
44 views

How can a user Edit a file even when Write bit is off on a file

Here is the thing i just had a urge to play with umask on my training machine. i created test user john and logged in using john. and set the umask to 0200 and created a testfile in vim and saved it. ...
1
vote
1answer
34 views

how to search file for begin of string and save a variable

i am trying to find a way of searching a file for string, it needs to work by searching then file and if any line in the file begin with what i am searching for, then take that whole line and save it ...