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

learn more… | top users | synonyms (1)

0
votes
0answers
64 views

ETL testing - Unix Commands

As part of etl testing I need to find record count for each different record. Currently we are having some 8 different record types in the flat file. Is there any unix command to find the record ...
0
votes
1answer
15 views

Relocate file into subdirectory

I'm bit new to Unix. Please help with below question though it may sound very simple. How to relocate file1 into subdirectory dir1?
2
votes
1answer
35 views

Compressing all files that contain a particular string

How can you compress all files in a directory that contain the word “compress” anywhere within its contents?
3
votes
3answers
171 views

Which command to use to find all files/folders with non-default permissions?

Suppose I have a folder, containing other files and folders, and I'd like to find out recursively which subfiles and subfolders have non-default permissions (i.e., not 644 or 755). Which command can ...
2
votes
3answers
42 views

How to get a list of applications associated with a file using command line

File associations usually are made in the desktop environment, but how to get a list of applications associated with a file using command line? Something like: $ getassoc foo.pdf <CR> $ ...
1
vote
1answer
42 views

brasero.toc.bin is very big — why?

I have a file in my home directory: brasero.toc.bin, which ls gives as: -rw-rw-r--. 1 Harry Harry 633M 2013-09-26 15:53 brasero.toc.bin in fact it is the second largest file listed, only sdc at ...
1
vote
2answers
29 views

Files missing from NTFS drive and drive is split into many

Using kali linux 1.0 in dual boot with windows 8. I have an NTFS partition (D: on windows) I usually mount it on both OS. I face the following problem 1. cannot access some folders in NTFS partition. ...
4
votes
1answer
78 views

Why I cannot move to trash from /var/tmp?

I just found out on Fedora 20, that neither with Thunar nor Nautilus (I'm using Xfce4 here), I can't move file from /var/tmp to Trash. More precisely, in Nautilus the menu option is not available, ...
4
votes
2answers
72 views

In Linux Fedora, How can I select files to move by time interval

How can I select and move files that were written in a specified time interval, such as 1530 to 1730 local time on a recent date? Background: I use Linux Fedora 12, and I have made my first, and long ...
0
votes
2answers
67 views

How can I concatenate all files in a directory together in one command line operation? [duplicate]

I have 1000 csv files in a directory. I would like to concatenate them all together in order. They are named img_size_1.csv to approx img_size_1000.csv This answer is close but assumes a list file. ...
1
vote
1answer
48 views

How do I identify the user that is attempting to create a file?

I have a PHP script that is attempting to create a file, but it can not because of permissions. I would like to identify which user the system sees as the one requesting to create the file. I would ...
1
vote
2answers
50 views

Something like a symbolically linked file, but with change details attached?

Is there a file type or method for using files in which certain files look and behave like symbolically linked files, but contain extra meta information for changing the data when they are read? ...
7
votes
4answers
264 views

Grep from the end of a file to the beginning

I have a file with about 30.000.000 lines (Radius Accounting) and I need to find the last match of a given pattern. The command: tac accounting.log | grep $pattern gives what I need, but it's too ...
3
votes
2answers
97 views

How much text does grep/egrep consume each time?

I'm confused on grep/egrep. These tools match a single line I think? In some cases I have heard "logical" line. Questions Is it correct to assume that essentially grep/egrep always processes a ...
6
votes
1answer
159 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 ...
5
votes
4answers
257 views

How do I get a single total of lines with `wc -l`?

I've added a git alias to give me the line counts of specific files in my history: [alias] lines = !lc() { git ls-files -z ${1} | xargs -0 wc -l; }; lc However, wc -l is reporting multiple totals, ...
3
votes
1answer
51 views

timestamp of newly created file is in the future

On my machine at work I experience weird timestamps of files. This is bothering me, because it messes with make. To reproduce the issue, this suffices: $ touch foo $ stat -c %y foo 2014-01-31 ...
4
votes
4answers
147 views

Keeping the number of files in the folder constant by deleting old files

I'm trying to create a script and run it in crontab every 5 min, so that the number of files in a folder always remain 50000. If there are more, I want the script to delete the old files. ...
2
votes
1answer
36 views

Filesystem content inspection GUI (like gconf-/dconf-editor)?

Within, for instance, /sys/kernel/debug/tracing, the kernel makes many settings available as files, whose contents should be read in order to see what that setting is. Of course, typing cat ...
1
vote
1answer
50 views

What is difference betwen gid and groups

I was wondering about the following behavior: I have three users A, B and C. A creates a folder and changes the group ownership to C's group. mkdir fold chgrp C fold chmod g+rw fold Now I add B to ...
3
votes
1answer
42 views

Where are information stored information about hard/soft links

Where does the *nix system store information about number of hard links to a specific inode? I can't find any information about that. Everywhere what a hard link is but rarely a bit more advanced ...
1
vote
4answers
109 views

Bash Script to Sort Files into Alphabetical Folders on ReadyNAS Duo v1

I have an old ReadyNAS Duo v1 (Sparc) running an unknown flavour of Linux. I have a folder structure with 1,000+ files I want to move into a folder structure based on the first letter of the file ...
6
votes
5answers
741 views

How does one find out how many bits a file has in one command?

I know I can use ls -lat to find out how many bytes has a file and then multiply by 8 to find out how many bits. But is this possible in only one command line?
0
votes
1answer
46 views

Explain the “@” symbol in this permissions example [duplicate]

I have a file on my Darwin system and the permissions are: -rwxr-xr-x@ User: read, write, execute Group: read, execute Other: read, execute What is the 11th notation the @ mean? In addition to ...
1
vote
1answer
60 views

Monitor file access count by user

I have written a script which is deployed just by putting it in a globally accessible location for all users. I want to log the usage of this script. Is there a way in Linux to find out how many ...
2
votes
3answers
34 views

Full path in glob in Zsh

Say I run the following on /some/path: for x in foo/*; do print $x done Are there any parameters I can use to tell Zsh to print, not just the filename, but the full absolute path to $x? (without ...
0
votes
0answers
33 views

Issues with sharing partitions using NFS

We have 3 servers: Server1, Server2 and Server3, all in the same network. On Server2 I'm sharing a partition, say /part1, to Server 3 using NFS. Here's the /etc/exports on Server2: /part1 Server3(rw) ...
-1
votes
1answer
171 views

Setfattr always returns operation not supported

I'm trying to get a script working however I'm having issues with a particular line trying to set file attributes with setfattr. The line in question is ret=os.system('setfattr -n "user.dummy" -v ...
-1
votes
4answers
69 views

Need a command sequence that will move files from one directory to another based on a particular year? [closed]

I'm looking for a sequence of commands (one liner would be ideal) which will identify all the files created in particular year, and move the resulting files to another directory.
1
vote
1answer
39 views

truncate a log file to zero while another process is continuously writing to it

I'm trying to debug this horribly hacky little program and it's writing a trace of all emulated instructions to a logfile which has grown to 2.5 GB in 45 min. I've only got 800 MB free. Can I ...
1
vote
0answers
30 views

Create a fake read only device like file with incrond

I need to generate UUID with uuidgen (not through any function call, but external command, because processes which will read the file cannot call any APIs or external commands directly). My idea is ...
0
votes
1answer
65 views

Passing multiple scripts to shell over ssh

I have a somewhat lengthy script which sources other scripts to include the functions there. I'd like to execute this script remotely via ssh. Now I thought to make one script file of it (without ...
2
votes
1answer
146 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
2answers
110 views

grep string from contents of file command then delete file

I have a peculiar problem I need help with. I have a large batch of .docx files where a certain number of them are junk. I know how to identify these files from the file command, as they contain the ...
0
votes
2answers
41 views

Machine keeps backups of files that I have already deleted

I recently found out that my machine keeps backups of files that I have already deleted. For example, a file called a.svg that I have deleted in the past, still exists in the directory it was deleted ...
0
votes
1answer
194 views

Delete all 'nohup.out' within a directory recursively

How can I delete all 'nohup.out' files within a directory recursively from my terminal? I'm using CentOS.
0
votes
1answer
42 views

Check multiple directory properties

I'd like to make this test as fast as possible: (Bash) if [[ -d $directory_path && -r $directory_path && -x $directory_path ]]
1
vote
4answers
54 views

Typical text files present on all (most) GNU/Linux systems? [closed]

I may need to develop some short snippets/examples involving reading text files; so I thought - why not use some files that are typically present on all (and since I sense "all" may be a stretch, then ...
3
votes
1answer
86 views

What is chmod 6050 good for

Recently I came across to command: chmod -R 6050 /usr/lib/hadoop-yarn/bin/container-executor I don't know what that mean? I know file permissions like 777 etc. in a mode rwx for owner group others. ...
0
votes
1answer
36 views

Files with “core” name

Can I be sure that files with name core on the system are core dump files? Or how can I be certain about some files that they are core dumps to delete them? (best practices are welcome)
1
vote
1answer
55 views

How to calculate the size of a file list (not a directory)?

This command: $ time (\ls /path/to/lots/of/dir*/*/*/*.ext > inputs.txt ) real 1m9.064s user 1m3.265s sys 0m5.993s Gives me a huge list of file names inside the file "inputs.txt". I ...
4
votes
4answers
188 views

How to randomly sample a subset of a file

Is there any Linux command one can use to sample subset of a file? For instance, a file contains one million lines, and we want to randomly sample only one thousand lines from that file. For random ...
5
votes
5answers
306 views

Number of files not containing given string

I read the question about how to find out the number of files that contain a certain string. This is possible with grep -l "string" * | wc -l. Is it possible to invert this, finding the number of ...
1
vote
2answers
51 views

Printing and deleting the first line of a file using `sed`

I can print the first line of a file using sed -n 1p file.txt I can delete the first line of a file using sed -i 1d file.txt Is there a way to print-and-delete in sed? Kind of like a FIFO pop() ...
2
votes
1answer
69 views

What does ^@^@^@ mean in a text file?

Sometimes I have problems with opening a file using a graphical text editor -- I'm using geany. The file can be read by vim without a problem. I checked the file, and there wasn't anything wrong with ...
3
votes
1answer
65 views

file corresponds to /proc/locks

$ cat /proc/locks 1: POSIX ADVISORY WRITE 458 03:07:133880 0 EOF 2: FLOCK ADVISORY WRITE 404 03:07:133879 0 EOF The fields are: ordinal number(1), type(2), mode(3), type(4), pid(5), ...
5
votes
3answers
258 views

How to detect if a file is hidden

I have written this code as part of some coursework, where we have to create a recursive file counter without using the find, du or -R commands. This appears to work but always returns ...
3
votes
2answers
75 views

How to force overwrite non-empty directories using `mv`

I am wanting to move (not just copy) a group of files/directories to a different directory some of which have name clashes with files/directories in the target directory. My main objective is to move ...
0
votes
5answers
167 views

On executable files in Linux [closed]

It is said that in linux, unlike Windows, there's not a clear border between executables and other files. Well, in Windows, I write a C++ program, then it is precompiled, compiled and then linked to ...
3
votes
3answers
100 views

Can removed Debian packages have leftover files?

I noticed a weird thing in my /etc/init.d files and tried to look a bit what was going on. Here's my problem: # apt-file search /etc/init.d/minissdpd minissdpd: /etc/init.d/minissdpd # ...