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

learn more… | top users | synonyms (1)

2
votes
2answers
66 views

remove whitespace from all items in a directory and sub directory

I have a directory which contains files and sub directories, some of which have whitespace in their names. Further more each of these sub directories contains files with whitespace in their names. Is ...
2
votes
1answer
30 views

How to tar-bzip old files in yearly groups

I wish to know a command I can use to grab and archive all files for a year at a time. I am working on a directory that has 72000 files, with files dated from 2007 to current. And I wish to make that ...
0
votes
0answers
35 views

How do I move files from a disk image using Terminal.

I downloaded an application (LaTeXiT) that installed itself as a disk image. I navigated to /Volumes and into the disk image, but when I try to move the contents to my /Applications folder, it returns ...
0
votes
0answers
79 views

How to check if the shell script created a new error log file in a folder with the same shell script? [duplicate]

I am trying to check if the new file is created in the specific directory or not when I run the shell script. Here, I am creating a new file through the shell script itself and then checking whether ...
3
votes
5answers
60 views

How one can re-read image with dd so it will match one you just wrote?

I have a ~1GB image that I'm writing to a 8GB SD card via the dd tool. I'd like to verify that it was written without corruption by reading it back and comparing its hash with original one. ...
1
vote
1answer
70 views

Delete all files to which no corresponding file with another extension exists

My goal is to find a Linux command sequence, which deletes some files if a special condition is fulfilled: All files with the extensions .cut or .cut.bak in the current directory shall be removed, IF ...
3
votes
2answers
137 views

Is there any Linux command to create a new file in a folder and auto create this folder if not exist? [duplicate]

I know this problem can solve by use combine mkdir and touch commands. But I want to know is there any other solution only use one command.
0
votes
2answers
62 views

How to find file without knowing the name of it [duplicate]

So I've finally given up after searching/trial and error for an hour now on how to find a file given specific criteria (none of which is the name of the file or the extension). The file info provided ...
23
votes
4answers
4k views

What is so special about Linux permission 004?

I was reading Practical Unix and Internet Security, when I came across the following lines which I couldn't comprehend. If you are using the wu archive server, you can configure it in such a way ...
2
votes
0answers
18 views

Specify the format of application temp/backup files in kde

Many text editors will create temporary or backup files with the format ~<filename>. Because of this, folders appear very cluttered with tons of files duplicated in this way ( <original> ...
2
votes
2answers
84 views

Sort files with a specific extension by modified time and store them into an array

I have found many answers to sort the files of directory and even to save them in an array. Sorting Example ls -t Directory listing in array array=(*) My particular problem needs to sort files ...
1
vote
1answer
56 views

Using Btrfs to eliminate corrupted archives

I am trying to get my personal filesystem in order I want to tar everything and get it organized into proper directories I have many HDDs and a few SSDs I want to use Btrfs with it's checksum and ...
0
votes
1answer
63 views

Can I use lzma compression, without using “tar”, on OSX 10.10.3?

I kind of think of OSX as Unix by another name. But, if I need to move this to the Apple forum, please tell me! I can create tar files compressed using lzma as such: $ ls ./DbDumps alpha.dmp ...
0
votes
1answer
35 views

Copying directories to directories with different names

How can I copy a number of directories: directory_01 directory_02 directory_03 to different directories tmp_directory_01 tmp_directory_02 tmp_directory_03 where each tmp_directory_* directory ...
0
votes
2answers
34 views

Why is there a minor number in /dev for directories such as pts?

This is a part of /dev in CentOS 6.6. What is the meaning of the minor number for directories like ., .. , bsg, block and ... ? drwxr-xr-x. 18 root root 3800 Jul 3 06:00 . dr-xr-xr-x. 21 ...
1
vote
1answer
35 views

Delete the first n bytes of a file in O(n) time

I've been browsing around looking for a solution for a personal project (Read: a coding experiment), but nothing quite seems to fit. To be honest, I don't even know if it's possible. Now, there's ...
1
vote
1answer
49 views

What is going on with Google Chrome and deleted files

Debugging some CouchDB problems, I was looking for (still open) deleted files: $ lsof -nP | grep '(deleted)' And to my surprise I found that Google Chrome has around 16900 such files: 15870 files ...
0
votes
1answer
40 views

Creating an symbolic link in /bin automatically creates a second link in /usr/bin and the which command chooses /usr/bin

I just created an executable: ln -s /path/to/script.sh /bin/script then I check if everything succeeds and it does(/bin/script is created) but this has also created: /usr/bin/script and if I ...
1
vote
1answer
55 views

Move files from multiple directories to another system

Let's suppose I have a folders in the source system: AB1, AB2, AB3. And I have the same folder names AB1, AB2, AB3 in the destination system. I want to move AB1 files to AB1 and AB2 files AB2 and ...
1
vote
0answers
29 views

How should I distribute files/packages/software across multiple drives?

I am primarily a Windows user, but I am starting to use Linux more as I realize all the features it has. In Windows, I install my software that I use regularly on my 120GB SSD, along with the OS, ...
0
votes
1answer
96 views

How to clear log files periodically

Hi I am new to Shell script. i want to clear log files in a directory basing on the dates. I have managed to gather this code: DIR1='/home/u01/app/oracle/servers/DIR1/logs' ...
0
votes
2answers
33 views

Where should startup scripts for a specific user be installed?

I have one script that will run when a specific user logs in. Where should this script and its assets be placed? I was planning to put it in /usr or /bin or /var, but I was wondering if there's a ...
0
votes
1answer
32 views

Directory Permission Order [duplicate]

In Linux, let us assume we have a directory with the following properties: drwx---r-x 29 user1 group1 4096 Jun 22 14:11 dir1 can I, as user2 having group group1, navigate into dir1? Since ...
2
votes
3answers
115 views

Delete several sequential file names, but ignore part of the first

Sometimes, my scripts get trapped in infinite loops. When the loop creates new files, things get messy. I currently have this file name format: Task.4883.store.log where 4883 is a counter. I ...
1
vote
2answers
66 views

How do I test if my variable is not in a set?

I am trying to modify the bash shell script and need some assistance. I have a directory with a bunch of files. What I need is to go through the files in a loop and if the file name not in a specific ...
2
votes
0answers
41 views

Process exceeding max open files limit

I am counting current open files by a process pid by :- cmd1:- ls /proc/$pid/fd/* | wc -l and then I am calculating percentage by fetching Max open Files limits. cmd2:- $ cat /proc/$pid/limits ...
1
vote
2answers
215 views

ldd says not found but .so file is in /usr/lib

When I type ldd with my executable file there is one not found warning. libCmp.so => not found libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6ed7000) libm.so.6 => ...
1
vote
4answers
65 views

Find text in a file and copy it to another file

Is there any command in Linux to find text in a file and if found then copy it in another file? Using sed -i we can find text but how to copy whole line in another file?
3
votes
2answers
87 views

Script for changing modification time of files and directories recursively

I have many big folders with thousands of files in them and I want to use touchto set their modification times to be "original time"+3 hours. I got this script from a similar thread in superuser: ...
1
vote
2answers
36 views

How to add some characters to filename via 'rename'?

For example I have a file named 5.jpg. How can I rename it to aaaaa.jpg with char a 5 times. I tried rename -v 's/(\d{1,})/a{$1}/g' * but this renames 5.jpg to a{5}.jpg, which is not what I want. I ...
-1
votes
1answer
23 views

How can I limit a log file to a certain number of most recent logs?

I know that you can limit the size of a file in respect to bytes, but I was wondering if there was a way to limit the number of logs within the file to, for example, the most recent 200 logs.
0
votes
1answer
41 views

How do I make 'sudo ll' work? [duplicate]

Every once in awhile, I find myself needing to list files in a directory that I don't have execution permission on. So I do a sudo: >sudo ll /opt/mydir [sudo] password for civfan: sudo: ll: ...
1
vote
1answer
24 views

How do you use 'find' to update ownership of all directories, files, and symbolic links in a folder?

I'm trying to update the ownership of everything in a directory tree from me to root. I'm using find to do it a little more carefully than a recursive chown. Here are the commands I use to change ...
2
votes
2answers
95 views

How can I shuffle pages from a pdf file in a random order?

I would like to shuffle the pages of a pdf document in a random order. How can this be done?
2
votes
1answer
28 views

How to guard a set of folders from being written into by a specific process?

I would like to have a way in which a set of folders do not allow write access for a particular process. For example, I would love to have a way in which YUM/RPM is not allowed to write into /usr/bin ...
1
vote
2answers
55 views

shell or perl script to check group have read privileges

ls -l drwx------ 8 ws web 1024 Apr 29 2013 abc drwxr-xr-x 8 ws web 1024 Oct 19 2011 def I need some script to find directories like abc which doesn't have read/execute permissions ...
4
votes
2answers
370 views

Where is the trash can for root partition?

I use trash-put to trash files from command line. Recently, I had aliased my rm command to trash-put so that I don't accidentally delete something important. However, what happened now was that I ...
1
vote
0answers
17 views

Allow move but not put in internal-sftp

is it possible with the internal-sftp to allow mv command from dir A to B but not allow put to A?
4
votes
1answer
35 views

Why can't another user access my file when it's a full path?

I have a program that runs a command that is something like this: /home/myuser/bin>> /usr/bin/sudo -u otheruser script.py /home/otheruser/file.txt This works, but now I need this to work when ...
2
votes
2answers
57 views

is it possible to search for files that have a special Linux file attribute?

is it possible to search file in the linux OS that have particular file attribute as this: ---S--l--- ---S--l--- 1 root root 0 Mar 1004:25/opt/csTuner/iba/wys/tuer_lolk What is S in ...
2
votes
2answers
45 views

One-liner to sort and uniq two outputs

I'm currently doing this to sort and uniq the output of two different commands: tshark -r sample.pcap -T fields -e eth.src -e ip.src > hello tshark -r sample.pcap -T fields -e eth.dst -e ip.dst ...
3
votes
1answer
179 views

How do you deliberately trigger a “text file busy” error?

Very occasionally I encounter "text file busy" error while using my Linux 4.0.4 computer. I read that when the error happens, kernel is preventing modification to a file that is being "used". So I ...
0
votes
0answers
58 views

Archlinux: Gnome 3.16 - ls & nautilus incorrect sorting

Recently switched from Xfce 4.12 DE to Gnome 3.16 and I have a problem with dirs & files sorting in terminal and nautilus. Test directories (how it should be): [ Pqr ] Abc Klm My current order ...
1
vote
1answer
328 views

Permission denied writing to mysql log

I am just testing out a new Ubuntu (Vivid 15.04) install on Vagrant, and getting problems with mysql and logging to a custom location. In /var/log/syslog I get /usr/bin/mysqld_safe: cannot create ...
0
votes
1answer
58 views

How to create a bash script that sees all files in a directory and tells me their size and date of creation?

I'm a beginner in the field of programing/coding. I'm trying to write a simple bash script that will see all files in a directory, and then tell me each file's size and each of their dates of ...
1
vote
1answer
117 views

get original creation date of html file

Can I find the creation/last modified date of an html file? For example, I would like to know when some index.html file from some website was created, not when I downloaded it.
3
votes
0answers
24 views

Is posix_fadvice / POSIX_FADV_DONTNEED functional in Linux?

If I am doing once only scanning across big files then do I need to worry about impact on the page cache or does the OS take care to avoid my scan causing pointless churn in the page cache. I want to ...
3
votes
3answers
37 views

Create 2 similar-name files with content from 2-line output of a command

I perform cmd and it outputs 2 lines of text: $ cmd foo bar I need to write these to: `/long/path/x.{load,conf} Writing to this destination requires superuser privilege, which rules out manually ...
1
vote
1answer
78 views

How to see if a file has CAP_NET_ADMIN?

I ran the following command: sudo setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip `which nmap` Now I'd like to add to my ~/.zshrc a line that detects such settings and exports ...
1
vote
1answer
32 views

What do you call the supervisord and php-fpm et. al. config format?

Both php-fpm and supervisord use a config format that looks like this: [category] settings = value some_other_setting = value Is there a name for this format?