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)

55
votes
5answers
31k views

Find duplicate files

Is it possible to find duplicate files on my disk which are bit to bit identical but have different file-names?
0
votes
0answers
12 views

Import Windows file into Linux Ubuntu VM [duplicate]

I have a Ubuntu/Gnome VM using Virtual box installed on an external usb drive. I have been emailed a ubuntu script recorded session from another user to my Windows PC. I want to be able to import ...
0
votes
1answer
271 views

Ambigous redirect done >$2

I have finished my bash script but I am still getting two errors. I've also searched for related issues but none worked: #!/bin/bash avem_element () { local e for e in "${@:2}"; do [[ "$e" == ...
0
votes
1answer
117 views

How to fix ntfs file problem when there is now windows?

I have a "stubborn" file on an NTFS partition which refuses to be deleted. A little background on the problem... Problem happened when I was running Zim on my Linux and the system froze due to some ...
0
votes
0answers
104 views

Google Drive HTTP Error when downloading .zip file with Firefox

I'm using openSUSE 42.1 and opened a fresh install of Firefox, but somehow when I try to download a zip file from my Google Drive, an error is shown: Could not download "[filename]". HTTP error. ...
0
votes
1answer
55 views

How “Max open files” soft and hard limit are set for specific process?

I used the cat /proc/<pid>/limits command to check the Max open file hard and soft limit, but I want to know how this value will be set and can it be increased or decreased? Is this value is ...
7
votes
2answers
653 views

Zip Archive With Limited Number of Files

What command can I use to create zips with a file number limit? I have a folder (no subfolders) of, say, 5000 files, so I would want a command that could divide that number and create 10 individual ...
-1
votes
1answer
23 views

adding date to beginning of file name using script

I have multiple files that need to be renamed with a date added to the beginning of the file name that I am trying to script. I'm using the cp command because I need to keep the original file I need ...
1
vote
2answers
59 views

Why does SCP fail when “RequestTTY force” option is enabled?

In my SSH config file, I have to enable the RequestTTY force for some important reasons. And currently my config file looks like this: Host x.x.x.x HostName yyyy StrictHostKeyChecking no ...
6
votes
2answers
11k views

What is 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 ? ...
5
votes
1answer
44 views

Clear recent open file history on Linux Mint

Sometimes others in my household briefly use my computer, when they do I sometimes don't want them to see my file history. I know how to prevent Bash from writing entries to the ~/.bash_history file ...
5
votes
4answers
7k views

Constantly check if file is modified bash

I have a file called file1 I want in a script, whenever there is a change in it, do something, a beep sound actually. How do I do that ¿? Thank you in advance
1
vote
0answers
84 views

how to limit file manager access based on users on Ajenti

I installed Ajenti-v on my ubuntu server 15.10 and I want to create multiple users with specific access to their home directory. currently, whenever I create a new ajenti user (which is synced with ...
75
votes
2answers
118k views

Empty the contents of a file

I am aware of three methods to delete all entries from a file. They are >filename touch filename filename < /dev/null Of these three I abuse >filename the most as that requires the ...
4
votes
1answer
46 views

File permissions on Linux?

I am surprised that /mnt, /media or even /opt are not writable by myself on my own system (Linux-Ubuntu). Should I always use sudo for any action on these paths? Or would it be better to add myself ...
1
vote
2answers
50 views

How to apply an awk script to multiple files in one folder using a loop

I am trying to apply one awk script to all the files in one folder, I am using: for %%i in (*.txt) do (awk -f NormalizeFiles.awk "%%i" > new\"%%i") but then I get the message: Syntactic error ...
3
votes
3answers
98 views

How can I test if a file in /root exists without su to root?

My OS is Ubuntu 14.04 LTS. I got a file /root/1.txt, and logged in with 'yu', who doesn't have read permission on this file. When I use the code if [ -e /root/1.txt ] , it returns false. I know I can ...
3
votes
2answers
77 views

Changing a file's modified date based on date in file name

I have a directory full of photos with file names in this format: IMG-20160305-WA0001.jpg. The date taken is obviously in the file title. Unfortunately the date modified on all files is today. I ...
41
votes
8answers
56k 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. ...
1
vote
0answers
29 views

Deleted file being written to by running process, can I recreate it? [duplicate]

I've started a long running process with nohup and redirected it's output to a log file Example: nohup ./bin/zkServer.sh start-foreground > /usr/local/myuser/logs/zkout.log 2>&1 & I ...
5
votes
2answers
23k views

Display a file's history (list of users that have modified a file)

Is there a command to display a list of users who modified a file providing a file history? I know that possible with svn/git etc.. but we have a config file that is not in SVN and someone modified ...
1
vote
1answer
24 views

How to clear data from all files present in a directory?

I have a folder which has some text files and other folders in it which in turn have more text files in them. I need a command which will recursively loop over the folder and clear all the contents ...
4
votes
1answer
28 views

Document Management System for Linux

So I got a problem and I hope someone knows the answer. Basically I am looking for a DMS (document management system) for my music and movies. I have a huge amount of files, currently in folders but ...
4
votes
3answers
365 views

What's the quickest way to find duplicated files? [duplicate]

I found this command used to find duplicated files but it was quite long and made me confused. For example, If i remove -printf "%s\n", nothing came out. Why was that? Besides, why they used xargs ...
1
vote
3answers
375 views

Copy content from files X and Y to create file XY but XY content is all lowercase

What's the right command to copy the content from file X and File Y to create a new File XY with all letters being lowercase?
21
votes
3answers
15k views

Determining if a file is a hard link or symbolic link?

I'm creating a shell script that would take a filename/path to a file and determine if the file is a symbolic link or a hard link. The only thing is, I don't know how to see if they are a hard link. ...
13
votes
5answers
43k views

How do I append text to the beginning and end of multiple text files in Bash?

I have a directory full of text files. My goal is to append text to the beginning and end of all of them. The text that goes at the beginning and end is the same for each file. Based on code I got ...
11
votes
5answers
18k views

How to remove blank lines from a file in shell?

I want to remove all empty lines from a file. Even if the line contains spaces or tabs it should also be removed.
1
vote
2answers
641 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?
0
votes
1answer
14 views

linux + sysctl.conf configuration

Is it right to comment line with # in the file sysctl.conf? I ask because I am not sure if the comment lines would be read or not. more /etc/sysctl.conf #net.core.rmem_default = 1048576 ...
13
votes
6answers
49k views

Add lines to the beginning and end of the huge file

I have the scenario where lines to be added on begining and end of the huge files. I have tried as shown below. for the first line: sed -i '1i\'"$FirstLine" $Filename for the last line: sed -i ...
0
votes
0answers
19 views

What does @ indicate in long file format? [duplicate]

NOTE: Don't know if this matters, but I'm running commands on OS X Terminal. What does the @ indicate about a file when it is listed in long format, ala: -rw-r--r--@ 1 <user> <group> ...
0
votes
1answer
26 views

Change last edited date [duplicate]

How can I change the last edited date of a file? There doesn't seem to be anything like: chlastediteddate 12/7/12 file What command can do this? Is there a way to do this without changing what the ...
2
votes
1answer
67 views

Create a file of fixed size with specific contents

I want to create a file of fixed size (1G, 10G, 100G etc) with a single random word of length within the specified limit on every line. I basically want this to run a benchmark which will sort the ...
2
votes
2answers
81 views

find: delete folder and sub folders but add exception to two files

I am trying to use the find command to do the following: Delete a whole folder with files, folders and subfolders except for 2 files, here is an example of what I need: test/folder1/file1.txt ...
4
votes
3answers
59 views

Split file by number of lines including header in each one

I need to split a .txt file into smaller ones containing 100 lines each, including the header. I don't know if this is relevant, but the original file is delimited like this: COLUMN1 | COLUMN2 | ...
0
votes
1answer
53 views

How can I execute any command as a normal user without sudo?

Is it possible to assign the sticky bit to sudo in order to execute any command as a normal user? Let's suppose that we have the user test and then: test@test$ apt-get update But I don't wanna use ...
11
votes
4answers
7k views

What's the difference between a hard links and copied files?

My understanding is that hard links include a copy of the original file and that I could delete a hard-linked file in one directory, and it would still exist in the other directory. If that's the ...
0
votes
6answers
110 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 ...
3
votes
2answers
81 views

Restrictive “group” permissions but open “world” permissions?

I understand that with Unix file permissions, there's "user", "group", and "world" octets. For the sake of this discussion, let's assume that setuid/sticky bits don't exist. Consider the following ...
26
votes
8answers
3k views

Is there a convenient way to classify files as “binary” or “text”?

Standard Unix utilities like grep and diff use some heuristic to classify files as "text" or "binary". (E.g. grep's output may include lines like Binary file frobozz matches.) Is there a convenient ...
3
votes
3answers
55 views

Get lines between two timestamps from a file

I have this large file that I need to go through using date and time. Every line in this file has a date and time in it. I need to search through the lines and get the lines that lie between two ...
15
votes
4answers
14k views

Delete the first n bytes of files

I've got an extreme problem, and all of the solutions I can imagine are complicated. According to my UNIX/Linux experience there must be an easy way. I want to delete the first 31 bytes of each file ...
9
votes
6answers
1k views

Modify a file without creating another file

Is there a way to modify a file without writing the contents to another file, without sed and awk? For example: $ cat test.txt aaa aaa bbb ccc ddd Replacing using sed with -i option, sed -i ...
3
votes
1answer
32 views

reserve disk space before copying files

I would like to reserve (or is the keyword "claim"?) some amount of disk space before an rsync occurs so other programs will believe a disk has less space (because after the rsync, the disk will have ...
0
votes
1answer
48 views

Copy last n-lines from one file to another

In the context of adding the same lines at end of the .bashrc or .vimrc files of several user accounts on the same machine, what would be an easy way to copy the last n-lines from one shell script to ...
1
vote
3answers
55 views

Is there a faster way to find specific files than using find?

I have to find in a folder the files not having certain permissions (755). The sub-directory has other sub-directories containing in total millions of files, and the find ./ -not -perm 755 command it ...
1
vote
1answer
44 views

Creating a virtual file whose contents are determined programmatically [duplicate]

Is it possible to create a virtual file in unix, whose contents are determined programmatically when the file is accessed, a bit like the files in /proc? For example, I have a program that retrieves ...
1
vote
2answers
32 views

How to know the path of a running executable?

I am working on a Linux server, and I running different jobs on different node. However, when compiling my program, I didn't set their specific name, so they are all a.out Now I found one of the ...
1
vote
1answer
49 views

How to organize files in Linux/Unix shell?

I would like to try to organize my documents, and I was told that I can do this using the linux/unix cygwin terminal. I searched for the command in google but all I ever did find was organizing the ...