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)

-2
votes
2answers
41 views

has a file changed of value [on hold]

im trying to use pyinotify to detect if a file has changed. managed to do it this way def status(argument): global email_alarm_status global new_email_alarm if not email_alarm_status: ...
1
vote
2answers
39 views

How to split a 6 or 7 GB file into several sub-2 GB files without splitting entry?

My level has 6 to 10 GB sized files as input. These files contain several lines of data. The next level's max input capacity is 2GB. So I have to split these 6-10 GB files into several sub-2 GB files ...
0
votes
1answer
41 views

Delete files older than X days - mtime, ctime and atime doesn't work

I'm running a script on synology (NAS) that is deleting files older than x days on certain folders. The problem is that I want these files to be deleted after X days of being uploaded on the folder. ...
1
vote
1answer
22 views

perl + uniq characters before variable

Please advise What is the meaning of the characters "%%" before the variable EOF ? $LINE =`tail -1 $FILE `; chomp($LINE); if ($LINE eq "%%EOF") { . . .
11
votes
2answers
476 views

How to set file permissions with touch command

It seems that whenever I create file with touch the permissions are set to: -rw-r--r--. Is there some way that I can configure the permissions differently with touch or does this have to be done after ...
0
votes
2answers
61 views

Reading a file incrementally

I have requirement where I need to read part of the file which was updated from the last read. I mean if I read the file last time at 2016-07-26T01:30 and after I want to run again at 2016-07-26T02:...
10
votes
2answers
503 views

How do I grant different permissions for each user?

So, I've been using Linux for a few years now, and I really should know this answer, but I'm having trouble finding it. Specifically I've been using Debian based distro's....mostly Ubuntu. If I have ...
1
vote
1answer
18 views

Find capacity details and oldest file in Busybox format

I am using Mobax and it has Busybox installed in it. I can successfully get the capacity, available, used and used percentage of the directory and its sub-directories in Linux by typing: clear &&...
0
votes
0answers
42 views

What may go wrong while copying file? [on hold]

I am writing a library as part of learning a new language which copies a file. The task is to copy the file content as using the nodejs Stream API. I am interested in knowing what can happen wrong ...
0
votes
1answer
35 views

Restore system file permissions

While I was setting up an Ubuntu server (EC2), I accidentally run the following: sudo chown -R www-data.www-data /* very dumb and noob move on my end. Anyway, is there an easy way to restore all ...
2
votes
3answers
37 views

Is it “broken” to replace an existing file without fsync()?

In Linux's mount(2) man page, I noticed the following excerpt: Many broken applications don't use fsync() when replacing existing files via patterns such as fd = open("foo.new")/write(fd,...)/...
0
votes
1answer
26 views

How can I retrieve the permissions of a file in a certain format? [duplicate]

I can change the permissions of a file by: chmod 600 ~/.ssh/authorized_keys How can I retrieve the permissions of a file in the same format which is 600?
0
votes
0answers
31 views

No such file or directory: But file exists [closed]

I am stuck in a very weird problem. I have a Bash script in a server A which is called from server B using another script. The script from server B returns "No such file or directory". The file is ...
2
votes
1answer
25 views

Does linux tar block write access to files

I have a large (>10GB) folder full of images on a live webserver that I need to back up and transfer. I'm worried that if I tar the folder, the files will be blocked for reading by the webserver, ...
2
votes
4answers
66 views

Extract the directory path containing the file with matching string

I have multiple subdirectories at multiple levels containing a file results.out ./dir1/results.out ./dir2/dir21/results.out ./dir3/dir31/dir311/results.out Now i need to search for string1 in ...
0
votes
1answer
17 views

How to write and handle custom log file properly?

I had a task that I have to write up a simple bash script which in turn executes admin command from Websphere Application Server (WAS). I put it into /etc/cron.daily folder hoping it would be executed ...
1
vote
2answers
50 views

Unable to delete files through Terminal

More recently, I have been using rm -r /path/to/file to delete files, but when deleting from certain locations, I get the error: override rw-r--r-- root/admin for filename? I have tried entering y, ...
1
vote
1answer
33 views

Clearing folders except specific type of files

I have tree of folders as follow: parent folder ....folder A ....folder B ....folder 1 ....folder 2 ....folder C ....folder 1 ....folder 2 ....folder D ....folder 1 ....folder ...
2
votes
2answers
38 views

How do I find files with multiple empty lines?

For replacing multiple empty lines with just one I need to find which files to apply this in the first place, in a big repository. How do I do that?
-1
votes
4answers
42 views

Extract files from a directory and save the files' names and sizes in KB in a CSV file

I want to retrieve all the .log files from the directory /var/log, store the results in a csv file along with each log file's respective file size in kB. I started by getting the files using find: ...
3
votes
2answers
44 views

Protect session log from being written again by anyone

We have implemented a workaround to save command history in a new file for each user session for audit purpose. So each session file is identified by the start time and the username. The problem: The ...
1
vote
2answers
37 views

list files with similar names sorted by similarity [closed]

Is it possible to search files and list them descending by similarity ? e.g.: Following files are in /: heo HELLO helo hello When I search for 'hello' I would like to have a List like: ...
7
votes
3answers
669 views

How can I safely ensure a variable contains only a valid filename?

Given the script below, how can I ensure that the argument only contains a valid filename within /home/charlesingalls/ and not a path (../home/carolineingalls/) or wildcard, etc? I only want the ...
4
votes
1answer
67 views

accessing path from outside the root with symlink

I need to add an outside path to my apache configuration. (httpd) so, I made a symlink to this path in my httpd root folder, the path is: /var/log/httpd/ (I want to display logs directly in my ...
4
votes
3answers
189 views

Shell script: “if file is not being used” condition

I'm trying to compress a virtual machine image file through a script, but I want to be sure the file isn't being accessed. I could check if virt-manager is running, since it should be the only program ...
3
votes
2answers
56 views

renaming mp3 files starting with “-”

I've extracted songs from my ipod, but when doing so, every song was renamed "- [original name of the song]" . I wanted to write a bash script that would remove that first "-" because there are maybe ...
1
vote
1answer
19 views

server file owner and group changed when editing file locally [duplicate]

If i edit the file from a remote server via text editor (geany, sublime text..etc) locally, the file user and group will changed to the logged user. Let say if I accessing the remote file with root ...
2
votes
3answers
109 views

Writing an unlimited number of defined values into a file [closed]

I can use /dev/zero or /dev/urandom to write values into a file. Is there also a way to write an unlimited amount (just restricted by a command line switch maybe) of defined numbers (e.g. 1, 2, etc.) ...
1
vote
1answer
75 views

Limit a directory to have only 1 file?

Is there a way to restrict a directory to have only 1 file? I created a specific directory for a user and I would like to limit that directory to have only 1 file. If that user wants to store new ...
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
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?
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 ...
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 ...
3
votes
2answers
77 views

How to Run a command on all subfolders

If you have a series of sub folders (like from a to z) and want to run a command on each one of them (like dsmmigrate * & ) how do you do that? The manual approach would be, cd a dsmmigrate * &...
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 ...
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
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/...
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
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 ...
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 ...
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 ...
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 ...