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

learn more… | top users | synonyms (1)

1
vote
2answers
46 views

assigning read/write privileges for a folder to a user in CentOS 7

I am logged into a CentOS 7 server as root. I created a folder /somefolder. I want someusername to be able to write to that folder via scp from a remote computer. What command should I run so that ...
2
votes
1answer
30 views

Linux Mint desktop displays different files from ls command

Background I'm running Linux Mint 17 Cinnamon. After a botched attempt at migrating my data to a NAS, I restored my data from an external USB. Problem Statement After restoring from backup, all my ...
5
votes
2answers
47 views

Merging/Combining 2 text files according to numeric field

I have 2 text files file_1: 14595|Age 35|Salary xx|Position ax|2013|Info 1|Info 2|Info 3|Info 4|Info 5 14649|Age 30|Salary xx|Position az|2015|Info 1|Info 2|Info 3|Info 4|Info 5 file_2: ...
4
votes
5answers
204 views

efficient cross-os file size shell function

I'm looking for a simpler way to have a cross-os-unix file size check. I could use wc -c but I'm concerned the performance may suck on large files (I'm assuming it just counts chars and doesn't do a ...
6
votes
4answers
154 views

Need to move the last line of the file to second line of the same file

I have a file 'test' in linux with below data. aaaaaa bbbbbb cccccc dddddd eeeeee I need to cut the last line of this file and put it in the second position. It must look like below. aaaaaa eeeeee ...
1
vote
2answers
19 views

May cp override subdirectories with the same name?

I downloaded an Adobe flash plugin, It includes a .so file and a directory called usr. In this folder, it has sub-folders like bin, lib, lib64, share. In the readme file, it says I need to do the ...
1
vote
1answer
33 views

Special character filename

I have to create such filename, so I can try one pipeline but I am not quite sure how it would happen. So the file's name(s): ;rm *;.jpg (or ;rm -rf *;.jpg). The format of the file doesn't matter, I ...
12
votes
4answers
377 views

A shell-like environment for binary processing

This question came to me a couple of times before, now in response to the question Loop through binary data chunks from stdin in Bash Answers given in ...
2
votes
3answers
49 views

Find command associated with configuration file

Let's say I didn't know what ~/.bashrc is for. Is there a command that would tell me what the file is/does? Other than googling for an answer. The man pages have a files section, maybe there is a way ...
0
votes
0answers
5 views

QMMP player takes over file-manger association in Manjaro Linux

Sometimes Firefox gets associated with a different file manager than the one it is supposed to. But now it got associated with a media player instead of a file manger; a very odd behaviour in Manjaro ...
1
vote
0answers
18 views

run a certain file (e.g. a .py) when a certain image, .wav or excel file get opened [duplicate]

Recently, me and my friend have purchased a Palm Vein Scanner. the goal was using it in a mini-project as a new door lock system. we are connecting it to a Raspberry Pi to run the software on it. ...
0
votes
3answers
47 views

Number of files in a directory starting with specific text

How to get count of files in a directory starting with specific text like dataxxx.csv
2
votes
1answer
44 views

How to count occurrences of all the words in all the files of a directory using grep? But with count incremented only once per word per file

I have already asked a similar question but people misunderstood what i was asking. I was asking how to generate a list of every word with a word count incremented only once per word per file. For ...
1
vote
1answer
20 views

How do I find/list all files on filesystem with a certain SELinux “fcontext”

I'm having trouble finding information on what command, presumably from setools, I should use to find all the files on my filesystem that are labeled by SELinux with a certain file-context (fcontext). ...
1
vote
3answers
5k views

Giving PHP permission to write to files and folders

UPDATED FOR FURTHER CLARITY: According to http://expressionengine.com/user_guide/installation/installation.html, it says: For most Unix hosts the following is typical, but you may check with your ...
1
vote
1answer
47 views

How to give permission to group to read/edit unowned files on archlinux?

I'd like to be able to read files from external hdd or other partitions without having to su root every time or chmod the whole partition to myself/group. How can I give myself/group permission to ...
-1
votes
2answers
135 views

delete files having a certain pattern in their names

I want to delete all files that have two numbers and a dot in beginning of their names for example: 01. abc 02. xyz
1
vote
2answers
74 views

How to rename file in bash script one by one

I have loads of files which look like this: data1.csv data2.csv . . data(n).csv My use case is that when I will call my script it will change data1.csv to data.csv and remaining files as it is and ...
8
votes
2answers
428 views

Finding a file type assuming wrong extension

I have an image archive I keep up. Sometimes, the sites I pull them from reformat the file while keeping the extension the same, most often making PNG images into JPG's that are still named ".png". ...
24
votes
2answers
8k views

I made a mistake last night, which deleted 1800GB of my File-Server unintentionally

I ran this command yesterday, I thought on a test machine, but it was a File-Server connected through SSH. sudo rm -rf /tmp/* !(lost+found) My terminal emulator is Konsole. My system is Debian 7. ...
6
votes
3answers
173 views

Is there a way to protect a file from being deleted, but not from being altered?

I want certain files to be able to be altered by myself on my basic account. To me, they are high priority files, with many backups. But we have some young'uns in the house and I don't quite trust ...
0
votes
1answer
35 views

Split the large files into sub files. How to do this process? [duplicate]

I have a large file in my unix box with 2 Gb. The files contains the xml lines. I want to split the files into say 10 files say each file is now of 204 MB ( approx ) so that combining the 10 files ...
2
votes
2answers
57 views

Check files for conventions

I need a script that checks and lists all text files for project conventions. With conventions I mean for example: UTF-8 encoding No trailing white spaces Newline at the end of file No not-ascii ...
39
votes
8answers
27k views

How can I edit multiple files in VIM?

I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time? Also, how can I tell the file name of the ...
6
votes
6answers
1k views

How can one run a program installed in one machine from another machine?

Is it possible to have, say, one machine with software installed and call that software from another machine? I thought this would be called an "application server" but by googling I find things that ...
2
votes
2answers
47 views

Deleting files older than a month [duplicate]

Need to delete all sub-directories which are a month old. But last day of the month data should be ignored for previous three months. The data representation is as follows: bkp_01102014 ...
1
vote
2answers
41 views

Convert a hardlink into a symbolic link

It is easy to convert a symlink into a hardlink with ln -f (example) It would also be easy to convert a hardlink (filenames link and original) back to a symbolic link to link->original in the case ...
0
votes
0answers
26 views

How to compare file sizes in two directories?

I have copied some files to an SFTP-only server. I want to verify that all the files arrived intact. Since the server is SFTP-only, I cannot run e.g., an MD5sum on the remote host. I have the server ...
12
votes
8answers
11k views

How to move 100 files from a folder containing thousands?

I have a directory with thousands of files. How can I move 100 of the files (any files will do) to another location.
2
votes
2answers
1k views

Sphinx Search shutting down after `FATAL: accept() failed: Too many open files`

I'm running Sphinx Search Server V2.06 ( the latest stable release ) on an Amazon EC2 with Linux CentOS. In general it is running fine, but the searchd.log is showing this error over and over with ...
1
vote
1answer
33 views

batch-rename all config file endings to conform to apache 2.4

since apache 2.4 all files in /etc/apache2/sites-available and sites-enabled have to be named with the ending .conf Now on my server I have a lot of these files, renaming the files in sites-available ...
2
votes
1answer
26 views

Remove created file after x minutes

I have a directory /my/path/tmpimages. Whenever a file is copied/created there, add a timer that remove that file after x minutes. What I found is that I need to use inoticoming or incrond to watch ...
0
votes
5answers
44 views

Is there a way to do a “full file buffering” inside a chain of piped commands?

Very often I do simple operations on a file, for example: cat file1.txt|sed -r 's/^ *//' to remove spaces at the beginning of the line. If I want to overwrite the file, the only way I know is: cat ...
1
vote
0answers
20 views

How can I set a group policy to all access on all folders except one?

I am currently making a test environment where users will be going through a network administration course with different levels they must complete. Due to the nature of the course, we want to give ...
2
votes
3answers
66 views

Is it possible to detect when a file has been downloaded?

We have a server where another script sFTPs and downloads files everyday. Question: Is it possible to detect that the file was downloaded and then for me to automatically archive the file after they ...
1
vote
1answer
39 views

How to change double hyphen to single hyphen of file names?

I have been using the rename command to get control over my naming conventions across my system. In converting spaces in file names to hyphens, I have inadvertently created consecutive hyphens in some ...
0
votes
2answers
33 views

Change file hard link count

On my Linux machine, I have the following file: drwxr-xr-x 2 jsgdr Unix_31 4096 Dec 2 17:46 jsgdr How to change the permission 2 to 4 so that I will this: drwxr-xr-x 4 jsgdr ...
7
votes
2answers
4k views

Group member cannot write even with write permission

The logged in user is a member of a group that has a write permission on a folder. But when this user is trying to write something, "permission is denied". The log below summarizes the question: ...
1
vote
0answers
52 views

Unable to access a directory despite belonging to a group with write permission [duplicate]

I am learning basic file permission in Linux and tried actions below. I have a folder "music" to which group "music" has wxr permission. I have user "finxxi" added into group "music". When user ...
0
votes
2answers
49 views

linux + find command with rm -rf

why the following command removed the tmp directory under /var and how to avoid this? find /var/tmp -type d -ctime -1 -exec rm -rf {} \; pwd /var/tmp [root@linux /var/tmp]# find /var/tmp -type ...
1
vote
3answers
46 views

Remove old directories according to directory's name?

In my bash script I create a directory each month for backups as follows: DAY=$(date -d "$D" '+%d') MONTH=$(date -d "$D" '+%m') YEAR=$(date -d "$D" '+%Y') mkdir -p /var/app/backup/$DAY$MONTH$YEAR ...
-1
votes
2answers
44 views

How to find a file on Windows in linux using the terminal

I have a .java file in Windows that I need to access in linux because it is a requirement of a homework project of mine to submit it to the school's linux server. In the past, I've copied and pasted ...
4
votes
2answers
9k views

Cron job to delete files older than 3 days

I need to remove files older than 3 days with a cron job in 3 different directories. (these 3 directories are children of a parent directory /a/b/c/1 & /a/b/c/2 & /a/b/c/3) Can this be done ...
0
votes
1answer
404 views

How do I create a RAM disk on Linux Mint?

I am running a package that adds data to the end of 140–300 files each time through the process. I'm thinking of moving the process to a RAM disk, and using rsync to copy it back when done. My goal ...
2
votes
2answers
43 views

Command to work on all files in a folder and output result to single file

I have a list of files, 10 to be exact, in a recipe folder. I must determine the number of occurences of each word in all the files and then order them according to these frequencies. I can get my ...
5
votes
1answer
129 views

How to make a list generated by md5deep in alphabetical order of relative paths?

If I want make a md5sum list recursively, then I would use md5deep, but it starts to pop up some problems such as it won't generate the md5sum file in alphabetical order. For example, $ cd ...
1
vote
0answers
24 views

Dynamic ~/.ssh/config

I'd like make my ~/.ssh/config file dynamically generated by a shell script (or anything else that prints to STDOUT). Is there a UNIX trick to make reading a file result in executing a command & ...
4
votes
1answer
366 views

How to rename all files and add image size to file name

I can`t make this work. I have a lot of images and i want to rename his name and append image size to name using exiv2 exiv2 pr * prints all info about file # exiv2 pr 9b523e5a002268fe5067a928 File ...
3
votes
2answers
190 views

Append timestamp of last edit to filename

I would like to add the time of the last change to the file to its filename using the bash. For example this output of ls -la: -rw-rw-r-- 1 beginner beginner 5382 Dec 1 17:18 B_F1-1.xml should ...
1
vote
2answers
37 views

Why doesn't my regex work in bash “if”? [duplicate]

Here is my code: if [ -f /Applications/xml[0-9].pl ] I also tried with -f =~ and double brackets but none seem to work. I first though that the regex might be faulty but I tried this. echo h1 | ...