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)

1
vote
1answer
43 views

Limited access to a directory's contents

There is a file in a directory that me and the other users want to be able to read. I want the other users not to be able to see the other files in the directory. They should be able to read a ...
-1
votes
1answer
37 views

File size limits

i have a text file which its size is 23.5 Mb. i want to reduce file size under 20 Mb. how can i do that? the file type is: plain text document (text/plain). this file have ~40000 line and ~500 column. ...
1
vote
1answer
31 views

Ubuntu shell curly brace expansion - confusion with sox command

I'd like to search through multiple subdirectories and convert all .mp3 files to .al files. Here's how I do it: find . -name '*.mp3' -type f -print0 | xargs -0 -t -r -I {} sox {} -r 8000 -c1 -e a-law ...
0
votes
1answer
38 views

How to maintain only four lines in my file in shell scripting?

Input file: 01.05.2016 87893938 02.05.2016 35435345 03.05.2016 35435345 04.05.2016 12345678 I want to keep only four lines in my file. that means if date 05.05.2016 6905698 is inserted then ...
3
votes
2answers
276 views

How can I find files with a long first line?

currently I have a problem with a server. One user who is hosting a lot of sites got hacked and some of his php files were modified. Now I want to get a list of the infected files and also want to ...
1
vote
2answers
61 views

Check in pure bash that the download is complete

short story is, I probably need a simple loop in bash which checks periodically whether the size of a given file has changed or not since last checked. Long story, I will be downloading a file ...
2
votes
1answer
89 views

Cannot mv to a subdirectory of itself

I am running this simple script and I am trying to create a cron job so that the file gets copied to my thumbdrive (with the new name) sudo cp /home/pi/NewLog.log /media/usb sleep 20 cd /media/...
0
votes
0answers
28 views

Can't delete files using SSHFS on windows

My problem is that i can't delete any fails from any folder using my windows sshfs client. Even though i'm logging in through root account, it still says that i do not have enough permission to ...
2
votes
1answer
66 views

How to delete files with ~?

I have removed all my python code from the home directory, but when I do ls I get: a11.py~ class1.pdf foobar.txt~ n1 pic.py~ When I do ls like this: ls *.py I get: ls: cannot access *.py: No ...
71
votes
1answer
7k views

Why does the following script delete itself?

If you create an executable file with the following contents, and run it, it will delete itself. How does this work? #!/bin/rm
3
votes
3answers
95 views

Display files to size with lower and upper bound without using `find`

I need to create a program via vim in Linux called between. The script takes two arguments as the lower bound and upper bound of the file size, and prints out a list of file names as well as their ...
13
votes
4answers
716 views

dd: multiple input files

I need to concatenate chunks from two files: if I needed concatenate whole files, I could simply do cat file1 file2 > output But I need to skip first 1MB from the first file, and I only want ...
0
votes
2answers
32 views

How can I give files extended attributes in mac os x?

How can I give files extended attributes in mac os x? Mac os x doesn't have the 'setattr' command.
0
votes
0answers
28 views

Qubes/Xen OS: access file manager for dom0

I hope somebody more experienced with Qubes specific terminal commands can help. If the KDE manager is installed, how does one open via terminal input the file manager for 'dom0'? To browse 'Home' ...
1
vote
0answers
25 views

Where is my 7za data being written to

I have a weird question about 7za on Centos 7. I am adding a file to a 7za archive using the following command (the total size of the directory is around 40GB) /usr/bin/7za a -ppassword -t7z -mmt=off ...
2
votes
3answers
41 views

Is there a way to see the dimensions of a jpeg file in linux using the command line?

I have some .jpeg images saved in a file in a cluster at school. I am at home using PuTTY to access one of the Debian nodes. I'm able to get to the folder with all the images but I need to see the ...
0
votes
3answers
32 views

How to apply dos2unix recursively to all the contents of a folder?

Is there a way to apply the dos2unix command so that it runs against all of the files in a folder and it's subfolders? man dos2unix doesn't show any -r or similar options that would make this ...
0
votes
2answers
48 views

How to see information inside inode data structure

I can do an ls -li to see a file's inode number, but how can I list information inside a particular inode by using that inode number.
1
vote
2answers
40 views

Are all files outside of /home/userabc owned by root?

I'm writing a tar implementation for a package manager, and I wonder if I can skip the permission setting of the user in the tar headers and keep what is there by default, the user who wrote the files,...
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
66 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 ...
-1
votes
1answer
24 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 ...
5
votes
1answer
68 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 ...
4
votes
1answer
48 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
64 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
2answers
100 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 ...
1
vote
2answers
72 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 ...
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 ...
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
33 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
386 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 -I{}...
3
votes
3answers
104 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 ...
1
vote
0answers
90 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 ...
0
votes
1answer
18 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 #net.core....
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
32 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
74 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 ...
4
votes
3answers
74 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 | ...
2
votes
2answers
84 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 test/...
0
votes
1answer
76 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 ...
3
votes
2answers
85 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 ...
3
votes
3answers
68 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 ...
3
votes
1answer
48 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 ...
1
vote
1answer
48 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
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 ...
0
votes
1answer
60 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 ...
27
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 ...
0
votes
2answers
33 views

Create a list of files in a directory with a certain char

I would like to be able to list all files within a folder which have a certain character as the third character. For each file, I then want to be able to perform an action, maybe delete or move. I'...
1
vote
1answer
52 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 ...
1
vote
1answer
32 views

How to search recursively within several levels of embedded tar tgz files? [duplicate]

Can somebody help me to figure out a command to find a file recursively that is embedded in a tgz file which is within another tgz files recursively: MainFile.tgz → SubFile1.tgz → SubFile2.tgz → ...