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

learn more… | top users | synonyms (1)

2
votes
1answer
39 views

Display file using Dialog

I have a file on disk which contains some text I want to display on the screen. You can do it like this: dialog --yesno "`cat FILE`" 10 100 However, I'm concerned that if FILE becomes large, I'm ...
12
votes
3answers
371 views

Move files and change ownership at the sametime

On Linux (Debian, Ubuntu Mint...), Is there any option command or something that I can use to transfer files to another user without having to do : sudo mv /home/poney/folderfulloffiles ...
15
votes
4answers
805 views

Is there an “open with” command for the command line?

Does the command line have a way to get a recommended list of programs used to open a particular file, based on the file type? For example, a .pdf file would have an open with... recommendation using ...
4
votes
1answer
34 views

Sharing a local directory between local users with full permissions

How do you share a directory /home/shared between two users "eris" and "discordia" such that both can access the directory in their respective home directory, e.g. /home/eris/shared and ...
4
votes
2answers
80 views

Opening a file with program in background from shell

The command to launch a program, say evince, from bash shell in background is evince & But what if I want to open some file with evince in background? Nor evince myfile.pdf & neither evince ...
13
votes
3answers
2k views

Why isn't there any shell command to create files?

Attention please: I am not asking how to make a file from the command line! I have been using touch for making files for years without paying attention that its main purpose is something else. If ...
1
vote
3answers
88 views

How to write a Java Program / Shell Script combination such that you can call the Java program as a remote command and yet supply a local file?

This is related to How to execute a remote command on a local file? I wrote a simple Java program that prints the first line of a file - import java.io.BufferedReader; import ...
1
vote
2answers
29 views

tar specific files based on a pattern

I got a lot of files with the following format: 2014_04_01_11.txt 2014_04_01_12.txt 2014_04_01_13.txt 2013_03_25_12.txt 2013_04_29_15.txt I would like to tar all theses files into an archive 20?? _ ...
3
votes
1answer
27 views

Merging text files based on their filename

I have hundred of files with the following format: 2013_01_19_xyxyxyx.txt 2013_01_19_xyxyxyx.txt 2014_03_21_xyxyxyx.txt 2014_03_21_zxzxzxz.txt 2014_03_22_abababa.txt 2014_03_22_cbcbcbc.txt etc. I ...
1
vote
1answer
80 views

File has bytes - appears to be empty

I'm having the following problem: Some text files (also some binary files) on my system are listed with the correct file size but when I open them, they appear empty. >ls -la -rw-rw-r-- 1 user ...
2
votes
0answers
20 views

File viewer (not manager) with dual pane

I have multiple papers, in multiple directories. let us call the papers A, B, C, D... and I have to write reports often, where I have to answer questions like Q1, Q2, Q3, Q4... Now, what often ...
3
votes
4answers
163 views

How can I count all the files on my system from root?

I want to know the total number of files on my server. Can this be done?
3
votes
2answers
48 views

Can I safely read a file that is appended to by another process?

If process A copies files to some location loc and process B regularly copies the files from loc to some other location, can B read a file that is currently in the process of being copied to loc by A? ...
2
votes
4answers
70 views

Can a running script identify the logging context?

Let us say I redirect the STDOUT, STDERR of a program to files. ./script.sh 1> output.log 2> error.log Can the running program find this out i.e. know the paths to these files?
2
votes
2answers
46 views

How to edit /etc/inittab?

I want to edit /etc/inittab in order to get a login prompt on the serial console once the system boots. By default, inittab file complains to be ro. I tried both gksudo gedit /etc/inittab and sudo vi ...
-2
votes
0answers
27 views

Alternative checks for ensuring correct file usage

Instead of targeting by file name, which can easily be duplicated or taken and assigned to a different file, what would be the safest (and perhaps most creative) check to ensure the correct file is ...
13
votes
2answers
384 views

Is that possible to integrate zip and tar.gz files as directory into the file system

I wonder if there is a way to integrate (it's a bit different from mounting, I think) compressed files as directories into the file system? E.g., one could download a compressed-file.tar.gz to his ...
2
votes
3answers
39 views

How to know the path to a specific file in a zip archive, without extracting it?

I only know the filename but not its exact location. I would like to extract only that file from the archive. And I need to know its location in the archive.
2
votes
3answers
104 views

Merge 2 files based on all values of the first column of the first file

I need to merge below 2 files: file1: TABLES REF-IO HEAD-IO DIFF-IO test 200 500 -300 exam 2 3 -1 final 2 1 1 mail 4 2 2 TOTAL 208 506 -298 ...
2
votes
1answer
46 views

Delete *.txt files by date between MMDDYYYY and MMDDYYYYY

How can I use rm to delete *.txt files between MMDDYYYY and MMDDYYYY ?
1
vote
3answers
52 views

Create directories from a list of files with spaces in name

I have a directory with a list of files in it. All these files have spaces in their names. I would like to create a directory, for each file, with the name of the file except the extension (which is ...
5
votes
3answers
114 views

Find the top 50 directories containing the most files/directories in their first level?

How can I use find to generate a list of directories which contain the most numbers of files. I'd like the list to be from highest to lowest. I'd only like the listing to go 1 level deep, and I'd ...
4
votes
7answers
482 views

How to split a filename list in 5GB sets?

I have a pretty big list of files which I like to group in smaller list of 5GB each for further processing. The file list is in the following form: "size" (from du) "tab" "absolute path", like this ...
0
votes
1answer
54 views

. (dot) shows up as path separator [closed]

I'm hunting a really strange bug: arian@orel:~$ ls ._cache.<tab><tab> Display all 205 possibilities? (y or n) ._cache.apt-file/ ._cache.chromium/ ._cache.chromium.Default/ ...
2
votes
2answers
67 views

How to rename filename with ' or ? in file name?

I have a problem renaming a file that I'm not even sure which special characters I have in the file. I'm using CentOS 6 64bit. When I ls the file: Giko Suzo San?e - Ep1.avi but when view it in ...
1
vote
2answers
56 views

Merge 2 files based on all available values of the first column in both files

I need to merge below 2 files: file1: viewer 23 test 27 remark 2 file2: viewer 2990 exam 200 remark 240 merged file should be as shown below: type value1 value2 difference ...
1
vote
0answers
36 views

How to properly use USB sticks on Linux and Windows machines? [migrated]

I've been a Linux user for about a year (Fedora 20) and have had a persistent problem with USB sticks (USB from now on for short) since then. I use my USB in both Linux and Windows machines, and my ...
1
vote
1answer
52 views

List files, directories and executables in current directory

I have php shell and I have function that do just that (but it give me error when I call scandir($path) function because of restriction in php), so I need to use my bash shell to do the same. It can ...
0
votes
1answer
42 views

undelete a just deleted file on ext4 with extundelete

Is there a simple option on extundelete how I can try to undelete a file called /var/tmp/test.iso that I just deleded? (it is not so important that I would start to remount the drive read-only or ...
2
votes
1answer
75 views

remove duplicate files in 2 directories

I have two folders (w/ subfolders) containing files that both contain essentially the same content. Example: /folder/files/data/new /folder/files/data/old Is there way to delete all files in /new ...
10
votes
3answers
349 views

Read the middle of a large file

I have a 1 TB file. I would like to read from byte 12345678901 to byte 19876543212 and put that on standard output on a machine with 100 MB RAM. I can easily write a perl script that does this. ...
2
votes
2answers
62 views

Shell Scripting: how to use part of the file path as the file name?

I have a group of directories, each containing exactly 1 jpeg image, like so- /psds/folder1/image.jpg /psds/someotherfolder/picture.jpg /psds/yetanotherfolder/thumbnail.jpg What is the appropriate ...
7
votes
1answer
51 views

Swap (exchange) two big files in limited environment

Let's say I have two flash memory devices 1GB capacity each. Let's also say each device contains one big file ~ 1GB size. Assuming, I have limited (64MB) RAM and no hard disk drive, what is the ...
1
vote
1answer
31 views

Rotating a file

I have an application which write to a file. Before I run the application, I would like to rotate the file. In others move file.n to file.n+1 file to file.1. I can write a script to do this, but I ...
1
vote
2answers
90 views

cp and mv if the file named already exists

What happens when you give the following commands if the file named done already exists? $ cp to_do done $ mv to_do done
1
vote
2answers
27 views

File not displayed using vi but visible with command ls -l CD*

I can do an ls -l CD* and see the following output. CDTEST userA RW RW R I am logged in as userA. But if I do an ls -l the file does not appear. If I do vi CDTEST it tries to create a new file ...
1
vote
1answer
41 views

Download Only a Part of a File

I am trying to find if it is possible to download a part of a file (any file) via axel or aria2 or any other tools available. For example there is a movie file (because doing this kind of thing ...
2
votes
1answer
30 views

Can not change permissions of files/directories in a chrooted filesystem

I am using Ubuntu 12.04 LTS 64 bits to chroot into a just extracted to my harddrive (with unsquashfs) Squash File System from a Kali Linux v1.0.5 32 bits pendrive for customizations: luis@Fujur:$ ...
2
votes
1answer
45 views

How to link the unlinked files?

When you rm a file it will call unlink(), and unlink() will remove the file from the Directory entry and its inode is freed. But, the actual content of the file is still in the disk. Is there any way ...
5
votes
1answer
96 views

Why does “cat ttyUSB0” not produce output?

I connected an infrared receiver to a USB port ... (the last line of dmesg tells device file) $ dmesg [10496.596063] usb 7-2: new full-speed USB device number 2 using uhci_hcd [10496.751112] usb 7-2: ...
2
votes
1answer
36 views

Equivalent of memmove on files: copy a range of bytes to an earlier position

What is an equivalent of memmove on files with the same input and output file? dd works when I move the file contents towards the right, but not if I move the contents left, since there's no handling ...
3
votes
3answers
183 views

Efficient way to create multiple files

I have been testing find directory which is taking max inodes and while testing I had run touch test_{1..1391803}.txt But it's give me error "-bash: /usr/bin/touch: Argument list too long", now ...
2
votes
3answers
228 views

How to recover from recursive 'chmod -x' on my home folder

I pressed ENTER after typing the following stupid command on my home directory: find . -type f -exec chmod -x '{}' ';' What do you advise as a fix for this. My guess is that I can't do anything but ...
0
votes
4answers
50 views

Copy files without changing owner [duplicate]

How to copy all files from /var/www onto a flash disk without changing owners of folders in the /var/www folder? (Or how to insert the whole /var/www folder into an archive and put it onto a flash ...
5
votes
2answers
104 views

Difference between xattr and chattr

What is the relation and the difference between xattr and chattr? I want to know when I set a chattr attribute in Linux what is happening inside the Linux kernel and inode metadata.
0
votes
1answer
70 views

I am the owner of a file and I have write access: why can't I save?

I am on OSX 10.9.2 I am locked out of postgres and trying to modify pg_hba.conf to get back in. http://stackoverflow.com/questions/11919275/can-not-enter-and-change-postgresql-pg-hba-conf-file I run ...
0
votes
2answers
42 views

file(1) command termination when using the -f - option

Say I'd like to use the file -f - command inside a script, and send some input using the stdin, when I'm finished I'd like to terminate it gracefully, but unfortunately I haven't found any way to do ...
4
votes
3answers
114 views

Hidden Files&Directories in user's home directory [closed]

I am in my user's home directory, I do: ls -a Then it shows me large number of hidden files and directories in my user's directory. Which of them I am allowed to remove? Which ones are necessary ...
4
votes
1answer
123 views

When was file created [duplicate]

How can i see when a file was created. I have looked at man page ls -lc is for last modification of file status ls -lu for access time ls -l not exactly indicated which time, last changed? I ...
0
votes
1answer
35 views

Updating last modified time of a file

I have created a script to read 15 pcap files from a folder and merge then into one file using mergecap command. I want the merged file to have the creation time same as the first file of the 15 files ...