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

learn more… | top users | synonyms (1)

3
votes
1answer
40 views

Run Script at fail login attempt?

Lately, I've been trying to create a Bash script to capture a webcam photo when a fail attempt to login is registered. First of all, I found 2 guides related to this (links at the end), they explained ...
0
votes
0answers
26 views

get time of file in inotifywait tool

for this script: inotifywait -m /path -e create -e moved_to | while read path action file; do echo "The file '$file' appeared in directory '$path' via '$action'" # do something with the ...
1
vote
1answer
26 views

TCL script try catch

I have a TCL script that sets a number of variables and reads several files. The last file it reads may contain sensitive information, so I need to make sure this file gets deleted even if an error ...
1
vote
1answer
18 views

How does ACL calculate the effective permissions on a file?

I ran the following command to give the wheel group rwx permissions on new files and subdirectories created: [belmin@server1]$ ls -la total 24 drwxr-sr-x+ 2 guards guards 4096 Aug 27 15:30 . ...
3
votes
2answers
43 views

How often is the /etc/shadow file backed up?

From man 5 shadow: /etc/shadow- Backup file for /etc/shadow. Note that this file is used by the tools of the shadow toolsuite, but not by all user and password management tools. What I ...
2
votes
2answers
74 views

find file, copy but with different name

I have files with random numbers in /home/user/files folder (every 4 days I have new ones). for example: john20 john25 john40 tom12 tom32 simon2 simon8 simon53 I want to take only last modified ...
2
votes
3answers
95 views

Convenient way to name files in Linux

I'm a beginner in Linux and want to learn to do things properly in this environment. Since the beginning I've noticed that a lot of people involved in Linux (like tutorials and guides) tend to name ...
0
votes
0answers
31 views

How to remove files except a list with names files [duplicate]

I need delete some .desktop files in various directories and a text file with a list of file names. I want to delete all these .desktop files except for those listed in my text file). Example $ ls ...
2
votes
0answers
30 views

Show the time as well as the date that a file was modified? [closed]

How can I allow the file browser, in Ubuntu 14.04, to show the time as well as the date that a file was modified? For example, the image shows the day the files were Modified...but I cannot find an ...
-1
votes
1answer
40 views

Why doesn't rsync take advantage of the mv command when --remove-source-files is specified?

Assume I want to move a tree in the filesystem, e.g. /path/to/a a.txt b.txt to another location with rsync (3.0.9 protocol version 30), e.g. with rsync -a --remove-source-files /path/to/a/ ...
2
votes
2answers
43 views

How do you get a count of all file extensions on a hard drive using the gnu+linux terminal?

On windows I have a program that can count all the files on a hard drive and the output shows a list of file extensions and a number (which showed how many files on the drive were for example are ...
0
votes
1answer
26 views

how to change where a symlink points [duplicate]

Can you tell me what is this in red marker area. ? and if want to change /media/files/tb-prod/files to some other path, then how it will be .. ?
0
votes
1answer
34 views

What dev folder allows you tell the OS to cache something?

Someone told me that there is a sub folder off of dev that basically allows you to tell the OS to keep the contents of that folder cached in RAM. So if I put some files & directories in ...
1
vote
2answers
46 views

How use minimum number of commands to copy all .txt files from all subdirectories to one directory?

I have more than 90 subdirectories and inside each one, there will be a number of .txt files. What I need to do is to copy all those txt files out to one single directory. How can I do that?
2
votes
2answers
53 views

Is reading a file on UNIX faster than writing a file?

Sorry for the sheer simplicity of this question. A rather obtuse performance bottleneck has boiled down to this very small query. I have done some empirical analysis and I think I might be getting ...
3
votes
5answers
155 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 ...
5
votes
1answer
156 views

“tail -f” show old file after file has been rotated [duplicate]

I have a script running continuously, reading tail -f /var/log/daemon.log The problem is, when the file /var/log/daemon.log gets rotated by logrotate, tail still has "file handle" for the old ...
0
votes
1answer
38 views

File not found: Beautiful Soup

I am trying to run a program that I downloaded in Ubuntu latest version, but I continue getting an error everytime I try to run the program. It says: File Not Found: BeautifulSoup So in order to ...
15
votes
5answers
1k views

Is there a way to tell sudo to set my username as owner for the files created instead of root?

If I do a sudo cp /etc/foo.txt ~/foo.txt, the new file is created with root as the owner. Right now, I see no way around this other than using the last two commands (ls to clarify use-case): ...
3
votes
4answers
69 views

How to remove text matching specific patterns from a file

I want to compare two files to check for differences between them, fileA and fileB. fileA is like a template file and fileB is the file which I want to compare to it. Anytime I find a difference I ...
3
votes
1answer
48 views

Recover atime after vim

I've vimed a file, and only afterwards realised that I need the atime (last access time) for the file. Is there any way to recover the atime for a file after accessing it inadvertently? The ...
0
votes
2answers
35 views

execute command from txt file

I have file and in this file i have this lines: ssh root@server1.com ssh root@server2.com etc.... And i have script that i like to go on every server and execute the ls command on each of this ...
4
votes
2answers
80 views

Why does 'find -delete ' delete all files in a directory recursively

So the following behaviour of unix find just cost me dearly: > touch foo > touch bar > ls bar foo > find . -name '*oo' -delete > ls bar > touch baz > ls bar baz > find . ...
1
vote
2answers
24 views

Remove all files without a keyword in the filename

I have a list of files in the following fashion: > file1.jpg > file1_orig.jpg > file2.jpg > file2_orig.jpg I want to keep all the files with the extension _orig.jpg and discard those ...
2
votes
3answers
50 views

What is the system-level effect of file permissions? [closed]

I know that r means read permission, w means write permission, and x means execute permission in the output of ls -l, like -rwxr-xr-x. But My question is what is behavior difference on operation ...
5
votes
1answer
921 views

How can two files in one of my folders have the same name?

I downloaded two files, they were both saved to the same filename and then I transferred them with scp to another computer. Why didn't they become one when the second was saved?
2
votes
1answer
29 views

How do I search files without certain extensions in their names?

I would like to search recursively in all the files and directories under a directory for some strings e.g. library. I also would like to exclude files and directories which store downloaded ...
3
votes
1answer
33 views

Methods to find out which (configuration) files are read by executable when started

What are the clever ways to find out which (configuration) files are read by executable if started? For example snmpd or sshd. One option is probably to check the CONFIGURATION FILES or FILES section ...
1
vote
3answers
121 views

Joining files on disk

Say I have several file with the following naming: 000001 000002 000003 ... Each of these files is a csv file (may include escape characters). In total the folder has ~20GB of data. How can I ...
0
votes
5answers
141 views

Move files to multiple folders [closed]

I've searched for this function, and there are lots of answers, but I haven't been able to find anything that works for me. I have a folder with about 30,000 files, and I want a terminal command or ...
-1
votes
3answers
30 views

Split a file into multiple based on selected lines [duplicate]

I have a file in which more than 50,000 lines are there. How can I split the file into two or more based on the selected lines? Suppose I want to split a file from line 10,000 to line 40,000.
0
votes
1answer
54 views

Accessing file from the Windows host in a VirtualBox virtual machine

I am running Ubuntu 14.04 as the guest operating system in a VirtualBox virtual machine. The host runs Windows 8 (24GB). I want to access a folder of the host inside the guest. Since the source is ...
3
votes
2answers
78 views

Deleted /tmp accidently

Accidently, I ran sudo rm -r /tmp, is that a problem ? I recreated it using sudo mkdir /tmp, does that fix the problem ? After I recreated the directory, In the places section in the sidebar in ...
2
votes
4answers
153 views

print capital words in first column of file

I want my output : VDD. GND AGNDSUB VMEASPOS. VMEASNEG VREFEXT File1 having following information : Power and signal VDD Digital Power This pin provides power supply connection for the digital ...
3
votes
2answers
52 views

Cannot delete File on Fedora

I have a file with following permission: -rwSr-s---. 1 1634630331 1818884080 118784 Jun 29 1970 DailyUpdateClass.class If I try to delete this file with root login, I get error. rm: cannot remove ...
1
vote
3answers
68 views

merging all files into one file?

I was trying to merge all the text files in to one file. All the text files has one column and equal number of rows. My data file names are data_1.txt, data_2.txt, data_3.txt, . . . data_n.txt. ...
1
vote
3answers
66 views

Unable to delete files as a root user using RS232 serial cross cable

I have a device(CCTV decoder) which was rebooting itself, so cant login using LAN cable. It has RS232 port only, no VGA and keybord/USB port(Embeded PC). I connected RS232 cross cable and used ...
4
votes
2answers
93 views

Convert file with integers written in ascii to binary file of integers

I have a file that contains a long list of integers written in ascii separated with newlines, like such: -175 2 -19345 345592 -45 2355 etc... I want to convert this file into a "binary" file ...
28
votes
6answers
2k views

How does Linux choose which application to open a file?

If a file tells the OS its file format, how does the OS choose which application to open it by default? In Windows, is the association stored in the registry table? How does Linux choose which ...
1
vote
1answer
62 views

Replace a string in a file and overwrite the file

I wrote my script using the the directory ~/deleted (it's a long script). after using ~/deleted for the whole script. I want to let the user choose the directory by putting the path in ~/.rm.cfg. My ...
0
votes
0answers
32 views

What are some preferred methods to efficiently edit files on a remote Unix server?

I'm looking for a more efficient GUI-based solution to edit root-owned and root-only writable files than using either nano or vim, both of which of course limit your cursor to navigate one character ...
1
vote
1answer
39 views

Compare file size of multiple files in an array [closed]

Scenario: Ftp site has 100s of files. Once a day, all the .gz files are copied to an AWS site then renamed. Only the date is kept in the file name. Some of the files corrupted during copy. A txt ...
0
votes
1answer
57 views

Delete ghost files with special characters

I have read several ways to delete files with special characters, but none of them works for me in one special folder in my cache system. I have no idea how the files got there, and why they turned ...
1
vote
2answers
38 views

Remove unneeded file lock in script

I have some script using flock executable. It works well. Problem is when this script calls another script, and it creates background process. In this situation background process inherits file locked ...
3
votes
2answers
78 views

Why does find -exec du sum up differently?

I have family pictures and movies in a folder /media/data/Selbstgemacht and I'd like to find the size of all pictures. In /media/data I use find Selbstgemacht -type f -iname '*.jpg' -exec du -ch '{}' ...
6
votes
4answers
356 views

Delete spaces, hyphens, and underscores in filenames?

What is a good command to delete spaces, hyphens, and underscores from all files in a directory, or selected files? I use the following command with Thunar Custom Actions to slugify filenames: for ...
4
votes
2answers
79 views

Write variable containing large text with \n to a file with common shell interpreters. How do you do it?

Environment: linux shell or better, ash shell in busybox (example system: Openwrt). Given a string variable with large text "${a}" constructed in this way: for index in $(seq 1 40000); do #it is ...
4
votes
2answers
174 views

Joining two files

I have a 2 files with the following: File1.txt A 1 B 2 C 5 Z 3 File2.txt A 4 B 7 C 10 D 11 What I would like to do is create something like A 1 4 B 2 7 C 5 10 D - 11 Z 3 - Is there a ...
1
vote
1answer
19 views

Measuring transfer speed of USB drive

I want to write a program to find out the average data transfer speed of my USB port. How do I go about implementing it? The only method I can think of is writing a large file to the path where the ...
1
vote
1answer
31 views

/proc/config.gz is of 0 bytes

I have an Android TV stck I compiled Linux for IT from https://github.com/Galland/rk3x_kernel_3.0.36 But when I booted that Image I found /proc/config.gz is of 0 bytes can some please explain how ...