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
34 views

how to search file for begin of string and save a variable

i am trying to find a way of searching a file for string, it needs to work by searching then file and if any line in the file begin with what i am searching for, then take that whole line and save it ...
-1
votes
3answers
45 views

What does it mean “Everything in the Linux is file” [duplicate]

Forgive me I am a novice of Linux. I just read the post here. It just said. This statement is true because there are special files that are more than just files (named pipes and sockets, for ...
3
votes
1answer
44 views

Sort files into folders, depending on filetype

I have about 2.8TB (yes, terabytes) of data I have recovered, this will be scanned for duplicates, the machine these files reside on is quite old and only has 2GB of memory (works fine for LVM, ...
3
votes
4answers
295 views

Delete file with filename that contain unallowed characters

In /tmp dir I have file with this filename: .<?php passthru($_GET['cmd']);echo 'm3rg3';?> I can't remove this file by normal means and have tried with quoting this filename with no results. ...
-2
votes
3answers
31 views

Making tar file to un tar file

using Red Hat Enterprise Linux Server release 5.6 (Tikanga), when I fire tar command it's taking huge time to untar file. Below is the command which I have used: tar zcvf filename.tar filename ...
1
vote
2answers
47 views

How to display the contents that give rise to the sizes that `ls -l` reports for directories?

I understand that the sizes that ls -l reports for directories reflects the space taken up by the "metadata" for those directories. Also, I imagine that this metadata exists in binary/non-human-...
0
votes
1answer
40 views

Using File manager with Second Hard Drive

I am going to install Ubuntu 16.04 on a new hard drive and install my current HD as a second drive. (It will stay there until I can copy over my /home directory to the new drive.) My questions is, if ...
0
votes
1answer
49 views

Rename file (Prefix) with full path?

I'd to Prefix my files (.dat) like this : CLY_BIZ_COM_PERD.dat -> 20160622CLY_BIZ_COM_PERD.dat I have tried the following: key=`date "+%Y%m%d"` for i in $(ls /Path/*.dat); do mv ${i} "${key}${i}...
0
votes
1answer
41 views

Rsync to copy specific subfolders and files to new directory

Original path, RootFolderI: RootFolderI/FolderA/Subfolder1/Subsub1/JPG1.jpg -> want this jpg RootFolderI/FolderA/Subfolder2/Subsub1/JPG2.jpg -> want this jpg RootFolderI/FolderA/Subfolder2/...
3
votes
2answers
55 views

magic example using search and/or regex

I am trying to have the file command detect some Windows text files that were never meant to be classified by file... The best choice seems to use regex to match the line content, but I cannot find a ...
-2
votes
1answer
57 views

cat command appears to be adding extra $ character at the end of each line

I am trying to create a file and it looks like the vi editor is adding a $ at the end of each line. I don't know what's causing this or how to prevent vi from doing it. vi file.txt 12345 abcde cat -...
1
vote
1answer
42 views

How to get file owner in AIX without munging ls output?

How might I reliably get the owner of a file in AIX? By reliable, I don't want to parse the output of ls. On Linux, I would just do a stat --printf=%U foo, but I'm working on AIX 6.1 and 7.1. I ...
1
vote
5answers
70 views

How can I use the rename command to fix these file names?

I'm trying to change files that look like 01 Track name.mp3 into 01 - Track name.mp3 So far my futile attempts were rename '0. ' '$&- ' *.mp3 rename 's/0. /$&- /' *.mp3 rename '/0. /' '/$&...
6
votes
3answers
634 views

Duplicate file x times in command shell

I try to duplicate a video file x times from the command line by using a for loop, I've tried it like this, but it does not work: for i in {1..100}; do cp test.ogg echo "test$1.ogg"; done
3
votes
2answers
67 views

Can you tell if a file has been renamed?

Many tools out there for syncing files aren't quite right for syncing you're home directory. Because of this, and to learn Ruby, I've been working on my own sync tool. An issue I've encountered, ...
2
votes
2answers
68 views

How to refer to multiple files from a directory to one command

I have a command that needs to take multiple input files, which are originally from one directory and have certain file name patterns. For example: In directory /home/mydir/ I have files: A.dat B....
1
vote
3answers
50 views

Move files by reading their file names to different directories

I need to move files by reading their names. I have to move system generated files and the names include a time stamp. I need to move the files by reading the file name by month. If the file name ...
6
votes
2answers
399 views

Remove all files with a prefix except the one of the largest size

What is the best way to remove all the files in the current directory with some prefix, except the file with this prefix but having the largest size among all the files with this prefix? (In the ...
4
votes
1answer
30 views

Why am I able to open this file?

While debugging a USB device usage I've come across a puzzling behavior of open(2): admin@anahata-core-i5:/tmp$ groups admin sudo admin@anahata-core-i5:/tmp$ ls -l /dev/bus/usb/001/051 crw-rw----+ 1 ...
1
vote
1answer
56 views

How to convert GBK to UTF-8 in a mixed encoding directory?

Background : You can skip this section, if you are not interested in. I usually backup my MicroSD card of my cell phone, with command sudo dd if=/dev/sdc1 of=~/Document/Cell\ Phone\ Files/...
-1
votes
1answer
31 views

Read file and write output in another file using shell script

My input file is: Employee e_id e_name 100 abc 101 xyz 102 pqr Salary e_id e_salary 100 12345 101 67890 Dependents e_id depp1 depp2 100 qwer tyui 102 asdf ghjkl I want the output line by line ...
0
votes
2answers
41 views

How do I make a server automatically move files?

I have a folder and I would like all the files that are put into that folder to instantly be moved to another folder. Is this possible.
4
votes
1answer
57 views

Decode binary output from Fortran program created on Sun Sparc system

I have one f77 file,which was created on SunSparc machine.I know that each record contains 5 reals and one integer.Is there any way how I could unpack that file on my Ubuntu 16.04 Intel little-endian ...
1
vote
4answers
80 views

script to delete files if there is no corresponding file with the same name but a different extension in another subdirectory

I have a series of preview images and RAW files in a directory structure (shown below), I quickly review the preview images, and delete those that I don't want. The RAW files are in a RAW ...
1
vote
1answer
36 views

Finding edited system files

I am installing a new OS (old = Ubuntu 12.04; new = Ubuntu 16.06). I want to be able to back-up any system files I have edited on the old system but don't know all the ones I have updated. How would I ...
0
votes
0answers
18 views

Find the process creating junk in my home folder [duplicate]

Some process keeps creating a folder called \~ in my home folder every time my computer boots up (and some other times, too) and it's really getting on my nerves. I guess this misconfigured app knows ...
4
votes
3answers
438 views

How to tell if a character special file would block if read from

I would like to be able to tell if a character special file would block if a character were read from it without actually reading a character from it. Can this be done?
1
vote
2answers
48 views

How to move string from one line to another

I have been editing a large text file containing pairs of lines as follows (repeated): \> destination_file.txt js -e "var e='.jpg',t='b',i='14712583',h='0.us.is.example.com',s='/',n='WIV',u='...
1
vote
2answers
46 views

Appending output of command in for loop

I am using a simple for loop to process certain input files and get the output in one file. What I am using is for k in ../some_directory/*.txt; do command (containing -i $k -o outputfile.txt); ...
5
votes
1answer
676 views

When files are being moved are they stored in a memory?

When I move a file using the mv command, is this file first read, fully cached into a memory and then saved as another file? Or is it the same as writing while read line; do echo "$line" >>...
0
votes
0answers
60 views

SFTP compression vs gzip when sending decent number of files

I have a directory that's got a few gigabytes composed of several ten thousands small files. I want to copy them over the network using SFTP. Initial research has proven that compression will reduce ...
1
vote
0answers
25 views

Removing dirs with lots of tiny files on Lustre

I have a dir with a gigantic amount of very small files that I want to remove and simply removing the dir with "rm -rf /path/to/the/dir" is already taking multiple days. It might sound strange that ...
2
votes
2answers
132 views

Multiplying numbers in-place in a file

I have ASCII file contain numbers as follow: 1 2 3 5 6 9 7 8 9 . . . . . . . . . . . . . . . etc I want to upgrade this file by multiplying each value by "3" to get : 3 6 9 15 18 27 21 24 27 ...
0
votes
5answers
109 views

how to iterate through files in directory excluding hidden files

Using: for eachfile in /mnt/thara/* Which iterates through hidden files as well. I don't need hidden files.
0
votes
1answer
36 views

Bulk file rename with a list of rules

Is there a way to rename multiple files, using some template written for example in the txt file? I need to replace some specific words with some other words in the bunch of files. I've got, say 1000+ ...
1
vote
0answers
20 views

Is there any way I can track down what is removing the executable flag from a file?

I have a set of git hooks that constantly have their executable flag removed. I'm utterly at a loss for what might be doing it, but so far the only thing I've found that can even mitigate the problem ...
1
vote
2answers
35 views

How can I log how often a file is modified on OS X?

I would like to know which files in my system I access most often, as a gauge of how important they are. I know the OS records the last time the file was accessed. Is there someone way to log in a ...
0
votes
1answer
50 views

List files before a specific date in bash [closed]

How to list files before a specific date in bash?
1
vote
1answer
33 views

On the fly compression of read- and writeable folder (like Windows EFS)?

Is there a possibility to compress the contents of a directory in Unix (especially AIX) on the fly, while still being able to read and write in the directory? Like the Windows EFS encryption does?
0
votes
1answer
32 views

How to use 7z and “for file” with multiple file inputs?

I have multiple files in a folder like: 1.txt 2.txt 3.txt ... 100.txt And I want to use 7z to compress single files, generating 1.7z, 2.7z 3.7z... I'm trying to use for file in {1..100} ./{1..100}....
1
vote
3answers
82 views

How to delete unknown file that doesn't have proper permissions

My co-worker sent me a theme in a tar.gz file and I tried unzipping it using the archive manager GUI as I usually do for any kind of zipped file. However, it produced a corrupt file/directory that I ...
1
vote
4answers
67 views

How do I delete file by filename that are set as dates?

I want to delete file not by date access or created, but by filename. The filenames will be dates and I want to have a cronjob run once a week that will purge filename dates older than 7 days. I could ...
1
vote
1answer
41 views

sh script containing perl element does not produce same output via crontab as manual execution

I tried posting this on Stackexchange but I think I may have more chance of a correct answer here as its very linux specific. I have an sh script which updates data in a csv, then runs a perl script (...
3
votes
1answer
41 views

Recursive move (`mv -rn`, like `cp -rn`), a move that will only move not present files

Context I have user uploaded content that needs to be backed up. The content is over 3 separate servers at /var/www/domain/media/ (on each server it is in the same place). The backup is a NFS ...
2
votes
1answer
42 views

Can directories and file inherit same permissions as parent directory?

I want all directories and files to inherit same permissions as parent directory.
1
vote
1answer
37 views

Disable OS-level caching

I want to be able to prevent the OS from caching in memory either: A particular file, or Any file a particular process accesses (i.e. by specifying a pid) Either would be helpful since I don't ...
3
votes
3answers
39 views

Differentiate betwen ELFves and scripts fast

How do I use file to differentiate between ELFves and scripts as fast as possible? I don't need any further details, just ELF, script (/plaintext), or other/error.
1
vote
0answers
37 views

Delete all the files which has only one line [duplicate]

I have a directory which contains about 9,000 files. I want to delete those files which have only one line. My command is: wc -l * | grep '^ 1 ' | awk '{$1=""; print $0}' | xargs -0 rm ...
1
vote
1answer
27 views

Extract creation date and modification time of file in Sunos [duplicate]

I want to extract creation date of a file and modification time. The format should be( yyyymmddhh24miss) My unix shell /usr/bin/ksh The file: file.txt My system: SunOS 5.10 Generic_150400-23 sun4v ...
0
votes
1answer
47 views

Explain the output of realpath [closed]

I am trying to use the command line to return the absolute path to a file. I read that there are multiple ways to go about this, namely the realpath, readpath -f, and locate commands. None of these ...