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

learn more… | top users | synonyms (1)

1
vote
0answers
12 views

Batch rename “case duplicates”

I have a folder on my Linux system that is cross-synchronized with other computers, some of them with Windows. The problem is that in that folder there are files that are "case duplicates", i.e. their ...
1
vote
0answers
15 views

Random file showing up in various directories. How to trace its creator?

I am finding a 0 byte file named ^- (that is a caret and a dash) in various directories on my file system. I use zsh with oh-my-zsh and I am pretty sure something in there is creating it but I really ...
4
votes
6answers
268 views

How do I grep recursively through .gz files?

I am using a script to regularly download my gmail messages that compresses the raw .eml into .gz files. The script creates a folder for each day, and then compresses every message into its own file. ...
-6
votes
0answers
26 views

Script for compare two file permissions

create dir, create two files with diff permission. Now write a script to test the permisiion of these two files. If its same then display the filename with its permission. if not display the ...
1
vote
0answers
12 views

FS on NFS share responding slow

We have two server ex name app1 and app2.Both server have a nfs mount from same server as below:- nfsserver:/prlocal 249G 190G 46G 81% /prlocal Now the problem is when we try to access the FS ...
2
votes
2answers
18 views

Network drives in the cloud?

Is there such a service that allows Linux servers to access remote cloud storage as if it were a file on a local network? I'm running a very small server, 512 MB RAM and 20 GB hard drive space, but do ...
3
votes
1answer
45 views

Edit a file via a script yet maintain the osx tags

On OSX you can have tags which allows you to identify different categories of files. Here are two text files with different tags when viewed in Finder: I have a large number of these files and have ...
1
vote
1answer
36 views

pass all files in directory as one argument to perl script

linux beginner here I have a directory with 50 files in it and I want to simultaneously pass them all to a perl script with just a space between names , as in... ./perl_script.pl file1 file2 file3 ...
3
votes
2answers
60 views

Use lines in a file to produce string and file name

I have a file, foo.txt, that has a folder name on each line: folder_1 folder_2 folder_3 And I'd like to do something like this: cat foo.txt | xargs -I {} echo 'function {}() { return stuff; }' ...
6
votes
3answers
835 views

Best way to swap filenames

I need to swap filenames of two files (file and file_1). I'm using the following code for it. mv file .phfile mv file_1 file mv .phfile file This works but is very buggy, It sometimes even results ...
1
vote
1answer
80 views

Swap two files in bash [duplicate]

How do I swap two files in Linux console with minimum typing? Boring approach: $ mv file1.dat fileX.dat $ mv file2.dat file1.dat $ mv fileX.dat file2.dat
0
votes
0answers
33 views

getting ? in permissions when running ll/ls command

I am trying to remove a folder and I am getting rm: cannot remove ‘...' when running the ll command I am getting : > ll ./folder/ ls: cannot access ./folder: Input/output error total 64 ...
3
votes
2answers
412 views
+50

How to copy files *to* a camera?

I'd like to copy a firmware update file to my Canon 7D camera, connected via USB. After it was auto-mounted by thunar + thunar-volman + gvfs-gphoto2 I tried the following: $ cp ...
4
votes
2answers
59 views

How to delete part of a binary file without copying

I need to delete the first 2 bytes of a 6MB file. However, this is an embedded Linux with only 32 Mbytes RAM and less than 1 MB free flash memory. I tried using dd, as: 1 - # dd bs=1 skip=2 ...
13
votes
4answers
23k 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 ...
0
votes
1answer
17 views

Relationship between file properties and user and group

There is something not clear on relationship between file properties and user and group. root@debian:/home/debian# ls -l /home/linuxsir total 4 -rw-r--r-- 1 linuxsir root 1549 Feb 23 19:16 ...
-3
votes
1answer
38 views

find all .sh files then copy to <date>scriptbackup

Locate all the .sh scripts you have created in your Linux installation (searching recursively if needed – excluding existing backup folders) It will then copy them all into a folder called ...
4
votes
4answers
2k views

Redirecting Output of print to multiples files in awk

I want to print same lines to 2 different files. What I am doing right now is: print ID[i]" "Value[i]" "TS1[i]" "TS2[i] > "file1.txt"; print ID[i]" "Value[i]" "TS1[i]" "TS2[i] > "file2.txt"; ...
0
votes
1answer
24 views

Print output of some my data in a file that should start with first line without blank space

By using some shell command i filter some output Please can some one suggest how i can print this output in some file For example I filtered some line and save it to some file but problem is it is ...
-1
votes
0answers
13 views

only onefile in the directory why display 4? [duplicate]

There is a only one file t2.txt in the /home/linuxsir,why total is 4 here? root@debian:/home/debian# ls -l /home/linuxsir total 4 -rw-r--r-- 1 linuxsir root 1549 Feb 23 19:16 t2.txt
31
votes
7answers
2k views

How can I trick a process into thinking a file doesn't exist?

I have a program that stores its settings in ~/.config/myprogram that I use both interactively and with a batch queuing system. When running interactively, I want this program to use my configuration ...
1
vote
1answer
16 views

Rename command with non-existing target directory

I'm trying to group files automatically into subdirectories using a command like this: $ rename 's/(.)(.)(.+)/$1\/$2\/$1$2$3/' *.* A dry run with the -n parameter shows me what I want: test.jpg ...
0
votes
2answers
24 views

How to specify the file type in a hard link [closed]

Does anyone know how to specify the file type of a hard link? Is this even possible? For example, I want to link to an HTML file (with content type text/html) in my website directory, so I used ln ...
3
votes
2answers
73 views

What is nobody nobody user and group?

On my server (Synology DS212) some files and folders have nobody nobody users and groups. What are the characteristics of this user and group? Who can write of read this file? How can I change it ? ...
0
votes
1answer
22 views

moving binaries from bin to specific folder

I want to install RNAhybrid tool so I downloaded it and configured it. I wanted to keep in a directory called programs, so I downloaded the tar.gz in that directory, extracted it and then used ...
0
votes
1answer
27 views

Solaris 11.2 extended permissions shown by ls

I have a file that shows up as having extended file permissions. ls -V /usr/share/X11/app-defaults/XScreenSaver rwx------ 1 root root 53 Dec 2 21:52 ...
1
vote
2answers
20 views

move content from a folder with unknown name up one directory

I have data arranged as follows: --parent_dir | --4Bz27go1c | -- foo.md -- bar.tar.gz -- baz.c .. I have a parent directory with a known name and a child ...
4
votes
3answers
259 views

Run command automatically when files are copied into a directory

I have two folders called: A and B, in different paths on the same computer. When I add any new file(s) into folder A, I want to copy it to folder B automatically. My folders: /auto/std1/nat1/A ...
0
votes
1answer
16 views

unix2dos not recogonizing outfile

I typed unix2dos /path/to/filename_unix.txt /path/to/filename_dos.txt in the CentOS 7 terminal, but I got the following in response: unix2dos: converting file /path/to/filename_unix.txt to DOS format ...
3
votes
5answers
950 views

How to get folder size ignoring hard links?

I use rsnapshot for backups, which generates a series of folders containing files of the same name. Some of the files are hard linked, while others are separate. For instance, hourly.1/file1 and ...
1
vote
4answers
77 views

Script to delete files that don't match certain filenames

I have a folder with 500,000 images, sorted in subfolders by year and month. I'd like to create a script that does this: If the filename does not match any of the filenames in names.log then delete ...
1
vote
4answers
4k views

monitoring file changes + process access to files

I would like to see what's happening in my app server folders, which files are changed by process x or which *.war files has been changed (replaced/created) in last x minutes. I am software developer ...
1
vote
1answer
45 views

Single record of a file getting splitted over multiple lines

We are using flat text files to store in teradata table after transformations from Informatica. The file contains 14 fields (~ separated). But as the records are getting scattered over multiple lines ...
46
votes
2answers
70k views

How can I replace a string in a file(s)?

Replacing strings in files based on certain search criteria is a very common task. How can I replace string foo with bar in all files in the current directory? do the same recursively for sub ...
0
votes
0answers
40 views

fopen problem when mounting ecryptfs filesystem

After an unrecoverable fsck problem the mount of my encrypted /home/me filesystem isn't possible any more. The visible effects are: a) logging in though most of the selectable GUI window managers ...
3
votes
1answer
57 views

Deleted folder keeps coming back

I have a directory at /opt/splunk that I cannot seem to get rid of. root@alpha:/opt# ls -la total 87156 drwxr-xr-x 4 root root 4096 Feb 20 15:44 . drwxr-xr-x 23 root root 4096 Feb 19 13:29 ...
2
votes
1answer
32 views

Creating symlinks in the etc directory without root access

What I would like to create if I had root access would be a symlink from some file or folder in the /etc to another file or folder in the /etc. However, I do not have root access. Is there any way to ...
1
vote
1answer
15 views

How to display metainformation for different kinds of time of a file ?

As far as I know each name within a path, e.g. /name1/name2/name3, is allocated to one inode. This inode is a collection of meta information for each name (file or directory). Some of these ...
2
votes
2answers
37 views

Set default permissions by file type (at least in Vim) [duplicate]

When I create a new script, I always have to manually add executable permissions with chmod +x foo.sh. My default permissions are set to 644, and but I'd like any file with extensions like .sh .py to ...
1
vote
1answer
43 views

Very slow file operation

I recently rebuild a machine with Centos 5.8 with a brand new disk. This machine is old and has been running 5.8 for a long period with no issues so the only thing which changed recently is the new ...
2
votes
3answers
2k views

How to remove an empty directory (btrfs filesystem)?

I'm using the experimental btrfs filesystem. My directory looks like this: ls -la empytfolder total 4 drwxr-xr-x 1 root root 0 19. Mär 14:00 . drwxr-xr-x 1 root root 298 19. Mär 13:59 .. I ...
1
vote
3answers
105 views

how to set up permissions of “download” dir to prevent execution of exploit program

There is a host with a local service that receives data from a remote location (via e.g. http) and saves it locally under /var/log/data/ in some mydir. $ ls -al /var/log/data drwxr-sr-x+ 4 root ...
1
vote
1answer
88 views

How to delete file called “-C” [duplicate]

I need to delete the following file which I managed to create with bunzip2: -rw-r--r-- 1 beginner group 67493376 Feb 17 17:30 -C The following don't work rm -rf '-C' rm -rf "-C" My OS is ...
1
vote
2answers
95 views

How do I wait for a file in the shell script?

I'm trying to write a shell script that will wait for a file to appear in the /tmp directory called sleep.txt and once it is found the program will cease, otherwise I want the program to be in a sleep ...
22
votes
7answers
35k views

How do I can get the size of a file in a bash script?

How do I can get the size of a file in a bash script? How do I assign this to a bash variable so I can use it later?
2
votes
1answer
1k views

How to Free Up Space in a Dynamically Growing qcow2 VM image?

This has happened to one of my VM's that's running CentOS under Proxmox. I copied about 40 GB of data into a VM. I then deleted that 40 GB data a day later. Now taking a backup of the same VM takes ...
3
votes
1answer
46 views

How do you get the first file in each subdirectory matching a list of file extensions?

How do you get the first file in each subdirectory matching a list of file extensions? My goal is to run a program on just any one of the files in a series of subdirectories. For example, below ...
0
votes
0answers
20 views

Folder keeps vanishing/showing up in finder, terminal says it doesn't exist

Upon a standard find routine I noticed a folder kept returning errors, even tough it didn't contain any of the arguments in the search query. Ilha-VB2-leo:FESTIVAIS_01-16 ilhavb2$ find . -iname ...
0
votes
1answer
21 views

linux (general) file/directory rename/delete operations under os permission scheme

In linux, do file/directory rename/delete operations belong to write permission?
9
votes
4answers
4k views

How do you compare two folders and copy the difference to a third folder?

You've got three folders: folder current, which contains your current files folder old, which contains an older version of the same files folder difference, which is just an empty folder How do ...