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

learn more… | top users | synonyms (1)

2
votes
1answer
11 views

Locate and manage files on extern hard drive through FileZilla over SSH

I have installed Debian Server on one of my servers and plugged in a extern hard drive to it through USB (sdb1, 2, and 5 on the image below) where I have all my files on right now. Before I used this ...
0
votes
0answers
19 views

Most efficient way to replace a line in a text document? [migrated]

I am learning to code in Unix with C. So far I have written the code to find the index of the first byte of the line that I want to replace. The problem is that sometimes, the number of bytes ...
2
votes
1answer
19 views

How do I transfer (to a usb drive) or read a .odt file in the command-line?

Currently my computer is not allowing me to start it up properly (guessing my hard drive is malfunctional), but I've figured out that Ctrl+Alt+(F1,F2,F3,F4,F5,F6,OR F7) allows me to access ...
-1
votes
0answers
15 views

CHMOD in FTP block - RESOLVED [on hold]

trying to change permissions on a file i'm FTPing to multiple servers. Using this in a shell script: ftp -n -v $TIP <<EOF | tee -a $FTPLOG user $TUSR $TPAS binary cd $TDIR/bin rename ...
1
vote
0answers
20 views

Lost Folders and Files in the directory /home/ubuntu/ in Ubuntu

I have uploaded a .tar file in /home/ubuntu/ and un-zipped the file in the folder name 'analytics'. After reboot, I couldn't found the directory and the tar files. I have checked it through SSH ...
1
vote
2answers
58 views

Save file after using sed command

I am using following command to replace yyyymmdd to YYYYMMDDHH24MISS in my file: sed -e 's/\('yyyymmdd'\)/\('YYYYMMDDHH24MISS'\)/g' filename After I run the command in PuTTY, it displays the file ...
0
votes
1answer
20 views

File -> ../../archive/folder/file restore

Hi i'm new to Linux and I need to use it temporary to set up LetsEncrypt. Once complete, I needed to move the /etc/letsencrypt/live/fullchain.pem file into the root dir but i moved the file ...
4
votes
2answers
66 views

Search directories for multi line string

Looking for a way to recursively search a repository for all files containing a multi line string and return the file names that contain it. The paragraph is just a header approx 30 lines. So I know ...
1
vote
2answers
36 views

Renaming a file the moment it appears in a folder

Here's the context : on a samba server, I have some folders (that we'll call A,B,C,D ) which are supposed to receive files from a network scanner. The scanner renders a PDF file named like this : ...
0
votes
1answer
31 views

How can I upload my .cpp file online while logged into schools Linux server through SSH?

I am currently in a basic programming class, and I finished my first project and it is a .cpp file. I am logged into the Linux server but I do not know how to upload a .cpp file online when I can only ...
1
vote
1answer
26 views

Symlink to same directory

I've set up a ftp server for using ftp push on a tv recording page. I've created an extra user for this, who has only access to one directory, which the user is chroot-ed in. But the page does not ...
0
votes
1answer
20 views

How to safely delete a regular directory that contains several btrfs snapshots inside it?

I have a regular directory than contains directly underneath it several btrfs snapshots. Is it safe to do an rm -rf on the parent directory, or do I need to first do a btrfs subvolume delete SUBVOL on ...
0
votes
0answers
31 views

limit of open files: Debian Jessies´ MySQL vs Community Oracle MySQL

I have just upgraded from MySQL Jessie 5.5 to MySQL Oracle Community Edition v5.6. I have a particular MySQL server, that has around 230 DBs, and > 32k files/tables. Whilst for two or three years, I ...
1
vote
3answers
36 views

How to join two files by matching a column with an irregular number of columns?

file1: 0000002|SLM DEV CORP |PO 857 0000003|S TOPPING |APT 19 0000004|JD BROS LTD ...
0
votes
0answers
34 views

Files mysteriously disappearing

Today, I opened my music player to play a particular song, and couldn't find it. So I check the filesystem - the entire folder for that album is missing. I did a count of the entire contents of the ...
1
vote
1answer
32 views

Allow file to be read by only system command in a C Program

I have a C program program.c that contains a system("/bin/cat file.txt") command, where file.txt is a file in the same directory as the C program. Now I would like to prevent users to read file.txt by ...
1
vote
1answer
13 views

File for assigned inet addresses

I am using Lubuntu 14.04 with kernel 3.19 and can't find file where are inet addresses stored (etc. 192.168.1.11). Man page for ifconfig state files: /proc/net/socket #can't find at all /proc/net/dev ...
-2
votes
1answer
33 views

What does the -p option do exactly with the cp command?

So I am trying to understand what is the significance of the -p option for the cp command. I opened the manual of the cp command and it says -p same as --preserve=mode,ownership,time stamps. But ...
0
votes
2answers
31 views

How to count how many files belong to each user/group combination?

How to count how many files belong to each user/group combination? I need to do this for each user/group combination that exists, in each of the directory trees /etc, /usr, and /var.
0
votes
2answers
39 views

How to merge files with same names

I want to know how to merge files with same names For example I have following files in one folder: 1081713FHN-NA.one_.txt 1081713FHN-NA.second_.txt 1081713UEN-NA.one_.txt 1081713UEN-NA.second_.txt ...
3
votes
2answers
194 views

How to write contents of a file to new file removing repeated lines [duplicate]

For example, a file file1.txt contains Hi how are you hello today is monday hello I am fine Hi how are you After the processing of file1.txt it should write to file2.txt and contents ...
0
votes
4answers
39 views

grep all the lines in a file and write line to a file from the pattern matching point

For example, a temp.txt file contains information like below: adsf on line jhkjhvjdbvjvbvbdjkvn qerwtt on line fdgdgdgdd qwqertg on line safffasffaf wrt on line adaddsd I want to grep for ...
3
votes
1answer
28 views

Head Script output explanation

So this shell script: #!/bin/bash head >/dev/null; head; almost always gives the same output when called with sequential numbers (e.g. seq 10000 | ./sscript) OUPUT: //blank line 1861 1862 ...
0
votes
1answer
26 views

How to move (image) files to other directories based on files' dates

I have a directory (currdir) with 24000 images on a centos/cpanel server. I want to split this directory by moving images from this directory into other directories (or sub-directories inside currdir) ...
1
vote
1answer
16 views

What does when the file's status was last changed mean?

I'm reading about find and for one of the tests (-cnewer file) it reads: File's status was last changed more recently than file was modified. What is the file's status? It's obviously a date, ...
0
votes
2answers
49 views

How to concatenate files using initial part of filename

I have many files with names in the form username_pattern_suffix.ext where "pattern" is fixed, but there are very many usernames, each with several files (i.e. values of 'suffix'). I'd like ...
0
votes
2answers
48 views

How can I filter out current directory ('.') in bash?

I'm currently trying to write a little script to convert all the flac files to mp3 files. However, I ran into a bit of a problem when trying to set up recursion down into all my music folders - the ...
10
votes
1answer
226 views

How to sort a file based on a section of a field

I would like to sort a file : D104HN-D104HA 8.320 4.521 1.69e+05 -- D104HN-D104HB* 8.320 2.823 2.93e+05 -- A90HB#-A90HA 1.655 4.207 7.12e+05 -- ...
0
votes
4answers
41 views

Transferring executable files from Windows to Linux via WinSCP

Why file lose execute permission on Windows when it is transferred from Linux to Windows and vice versa?
1
vote
1answer
25 views

Ways to consolidate music folder

Having used iTunes for a long time, my iPod Classic finally started showing signs of dying. I bought a FiiO X5II and put all my music onto it's microSD XC card(s) using rsync to ensure the same folder ...
0
votes
2answers
25 views

search the most latest's file name

I am writing a bash script to look for a file which's file name is most recently and file name like: ... Wed_Dec_30_16:47:41_PHT_2015.zip Wed_Dec_30_16:00:41_PHT_2015.zip ...
1
vote
2answers
32 views

Extract a particular substring from filename

I am quite novice in bash scripting. The task I need to solve is extract a particular substring from each filename in a directory. Example file names: Bob Marley - I Shot The Sheriff-2XiYUYcpsT4.mp3 ...
2
votes
2answers
57 views

How to copy image files whose names don't end with their resolution size?

I have a folder with images in it and it is organized by year and month folders (ie. /2015/08/image.jpg). Whenever an image is added, it is also copied and resized like so: image-1024x768.jpg ...
3
votes
4answers
101 views

Why does mknod require root privileges?

I noticed that the mknod command required root privileges when a creating a node other than a regular file, FIFO or a Unix socket. Why is that? How can a regular user harm a system or compromise ...
2
votes
2answers
222 views

What are the use cases for write-only and write-execute files? [duplicate]

I understand use cases for r-- and r-x permissions, but not for the -w- and -wx ones.
1
vote
1answer
46 views

ls -lu does not give last access time

The manpage of ls says: -u with -lt: sort by, and show, access time; with -l: show access time and sort by name; otherwise: sort by access time but that doesn't seem to work: ...
0
votes
1answer
23 views

Sort words from n rows

i need to print all the unique words and their occurences from first n rows in a give file. I have to sorted by their number of occurences and then alphabetically.(the only separator is " ") ex: for ...
0
votes
0answers
32 views

mount directory cannot be seen from within apps

I have successfully mounted a local network location on my Android device to /sdcard/routersd with permission set drwxrwxrwx; I can successfully browse within this mounted directory and do copy/delete ...
0
votes
2answers
41 views

Sort words in file

i've got some problems i'm not capable to overcome. I need to count the first let's say N words in a txt file. Then , i have to print them in decresing order, followed by the number of occurences.The ...
0
votes
2answers
29 views

Insert path in file

I have the a file.dat and would like to insert the path of this file as first line. Can anyone help me with this please ? Thanks in advance
2
votes
4answers
94 views

Moving and renaming hundreds of .jpg files, all named 5003.jpg

So here's the deal, my girlfriend wants me to transfer all of her photos off from her iPhone onto her laptop (on which we are running Ubuntu 14.04). All of the dedicated programs I tried to do this ...
4
votes
1answer
42 views

Prevent processing file until SCP transfer is finished

Large files are transferred to a server for processing. The server monitors a specific directory using incrond and when a new file is received the processing script is executed for that file. Because ...
0
votes
0answers
21 views

Incorrect file creation/modification time

So I run a backup script on a home server running Fedora 23. I also run a prune script that removes files older than 30 days. This fresh backup file keeps getting deleted because it's creation or ...
3
votes
0answers
47 views

Reason for security software to not scan directories with more than 10,000 resources in them?

We have a security software on Linux which scans for exploits in files that exist in directories on the server (such as if websites had hack scripts uploaded to them). It defaults to a limit of ...
4
votes
2answers
345 views

Is there an inode for a directory?

Each file has an inode. Is there an inode for every directory ? If not, how does Linux manage directories.
1
vote
1answer
26 views

How to convert file from one format to another with file attributes?

I have an audio file named with attributes: BreakingNews.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz I wanted to convert it to in below format: BreakingNews.wav: ...
2
votes
2answers
69 views

How do I rename files using the directory name?

My file structure now is: Input 1 pre.nii 2 pre.nii I would like it to be: Input 1_pre.nii 2_pre.nii From the Input folder, I tried: for i in */pre.nii; do echo $i_pre.nii; done ...
1
vote
3answers
52 views

Add extension to a list of files

I am trying to determine a perl method to add an extension to a list of files. I can already rename a list of files with a certain extension to some other extension, but I need to be able to do this ...
0
votes
1answer
66 views

Strange directories in /home

There are some strange directories appearing in /home (so far, maybe in other locations too). These directories do not show up in ls but do with bash's tab autocomplete, when doing things like cd. ...
1
vote
3answers
54 views

Duplicate file, replace character, then concatenate

I have a file that looks like this: i36aasf5i7538i123 i47982i16537i1256 i1647i6458i3457 i1856i8456i43865 I want to make a copy of the file, in which the first i in every line is replaced by an o. I ...