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

learn more… | top users | synonyms (1)

0
votes
2answers
16 views

Bulk rename, change suffix? [duplicate]

How can I bulk replace the suffix for many files? I have a lot of files like NameSomthing-min.png NameSomthing1-min.png NameSomthing2-min.png I would like to change all them to NameSomthing.png ...
0
votes
3answers
33 views

get IP address who modified a file

I am looking a way to to get the history of a file, like the modification date, who modified this file (ip address or username), the changed lines Is there a way to get the IP address or username of ...
0
votes
1answer
10 views

Extract field values values from log file

How to extract the specific field values from log file using unix command. For example my log file contains, ...
0
votes
0answers
18 views

Script acting as textfile, possible? [duplicate]

A program I'm running has a -logFile option. The file I set as a logfile is filling up quite rapidly, and I only need about half of what's actually in it. Is it at all possible to: have a script ...
1
vote
1answer
38 views

Get the real, apparent size of a folder

I am using the du command in order to get the size of the folder. As I am interested in the actual size I ended up with the following command: du –sh --apparent-size <someFolder>/ In this ...
2
votes
2answers
41 views

When can I omit the dot character that indicate the current directory

Should I use dot to indicate the current directory for accessing directories or should I use it for files only? For example, if the current directory is foo and it contains bar directory and baz.txt ...
-4
votes
3answers
47 views

Write file names in to a file

In a directory I have X.txt,Y.txt,Z.txt files. I want to move these filenames into a single file like below: Out_file.txt X.txt Y.txt Z.txt Any unix command to achieve this?
0
votes
2answers
26 views

How to change the first column of data in a file?

I have .data file containing a table of numbers with the column format: m x y z vx vy vz separated by tabs, with a depth of 2000. The file name is initc.data. I want to change ...
1
vote
1answer
22 views

Wipe files from an external hard drive but not empty space

I'm using the following command to wipe an external drive. sudo shred -v -z -n 1 /dev/sdb Is it possible to wipe an external drive of the files and not empty space? So it would overwrite where ...
1
vote
3answers
112 views

Finding and removing words beginning / ending with numbers

I have a large file (>10000 lines) that contains one word per line, with a newline character after each word. The words contain no spaces. I'd like to list (or even better, output to a new file) any ...
0
votes
1answer
38 views

linux compare text file [duplicate]

I have file1.txt and file2.txt, both contain URLs, I want to create a new file with the unique URLS present in file2.txt and not in file1.txt. Example urls file: aspencabinets.com.au iiatca.org ...
0
votes
0answers
20 views

meaning of !(something) in shell [duplicate]

While searching for a way to move all files in a dir to one of its sub-folders, i came across mv !(something) something which should do the job - but only in bash. However i could not find why. in ...
2
votes
1answer
40 views

Information leaks out of encrypted file system

If I only encrypt the home directory, what are some common ways for information to leak out to the unencrypted part of the file system? Aside from the obvious problems like swap space files in /tmp ...
1
vote
2answers
39 views

How to remove prefixes and suffixes from filenames in a given directory?

I have many files with the same prefix and the same suffix. I want to remove both from filenames. Both contain spaces. So foo bar XXX doo par.jpg, foo bar YY YY doo par.jpg would become XXX.jpg and ...
1
vote
3answers
35 views

Run a command over directories with name recursively

I have the following directory structure in AIX. codeRepo/REPO1/AREA1/objects codeRepo/REPO1/AREA2/SUBAREA1/objects codeRepo/REPO1/AREA2/SUBAREA2/objects From codeRepo I want to run chown myUser * ...
3
votes
1answer
22 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 ...
3
votes
2answers
29 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
16 views

CHMOD in FTP block - RESOLVED [closed]

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
37 views
+50

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
61 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
21 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 ...
5
votes
2answers
68 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 ...
2
votes
2answers
37 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
34 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
1answer
46 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
35 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
34 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
34 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
42 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
196 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
43 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
27 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
44 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
59 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
108 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
223 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.