date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,294,409,653,000
man git-format-patch makes reference of the UNIX mailbox format which is a term I am unfamiliar with. A google search for "UNIX mailbox format" and similar expressions lists many hits with the term mbox in it. There is even a man page (man mbox) for mbox. I am lead to conclude that mbox and the UNIX mailbox format are...
Can someone confirm (or deny) my assumption? Yes, Both are same. UNIX mbox format is used by AsyncOS when messages are archived (in anti-spam and anti-virus configuration) and logged (in the message filter log() action). mbox is traditional UNIX mailbox format. Users' INBOX mboxes are commonly stored in /var/spool/m...
What is the unix mailbox format?
1,294,409,653,000
I am using GParted for formatting my usb-device(a pendrive). And, I unmounted my device using the GUI program itself. The device doesn't show mounted anymore. When I try to format my usb-device(/dev/sdc1) with ntfs-format, the ntfs operation seems disabled in the GParted (GNOME Partition Editor) GUI. Rest other option...
OK, finally I got the solution. Though I was already having package ntfs-3g previously installed, it was not sufficient enough for formatting of the usb-drive in ntfs-format. One needs to install ntfsprogs --- a subpackage of ntfs-3g for enabling the ntfs-format type partition in GParted. I installed it using sudo yu...
NTFS formatting disabled while using Gparted in CentOS 7
1,294,409,653,000
I have a memory stick that is not mounted in Ubuntu and it doesn't works in Windows. I can check is connected using Bus 003 Device 011: ID 05e3:0727 Genesys Logic, Inc. microSD Reader/Writer But I cannot mount it. I want to try formatting it to check if is detected again in Windows and Linux. How could I do without m...
There are many ways to format a USB Command line Type this command in the terminal which will help you identify the USB name i.e: sdb,sdc,etc... sudo fdisk -l Make sure the USB is not mounted, if yes then you need to unmount it: umount /dev/sdX Replace sdX with your device name Delete any existing partitions (from...
How to format a USB storage not detected in Ubuntu?
1,294,409,653,000
Is there a way to restrict directory content by the file type? For example, I have an upload directory that I only want users to put images in, could I go a step further & actually put a restriction that will only allow images in it? I thought about a CRON Job to check the file extension but wondered is there was anot...
There are a number of problems with trying to enforce this "after the fact" using a cron job or similar: Race condition. Regardless of which method you use, if you have some program or some code that will be looking through the directory and may pick up and use files you don't want it to interact with, the only way t...
How could I restrict directory content by file type?
1,294,409,653,000
Given a .jpg picture without associated GPS coordinates, how would you suggest to add custom coordinates to it?
You can use the exiftool command e.g.: exiftool -exif:gpslatitude="Put_the_GPS_coordinate_here" -exif:gpslatituderef=S your.jpg Verify it: exiftool -filename -gpslatitude -gpslongitude -T your.jpg
How to add a custom GPS location to a picture?
1,294,409,653,000
Sometimes it seems that the standard file command (5.04 on my Ubuntu system) is not sophisticated enough (or I am just using it wrong, which could well be). For example when I run it on an .exe file, and I am quite positive that it contains some archive, I would expect output like this: $ improved-file foo.exe foo.exe...
I can't think of an all-in-one tool, but there are programs that can cope with a large array of files of a given category. For example, p7zip recognizes a large number of archive formats, so if you suspect that a file is an archive, try running 7z l on it. $ 7z l ta12b563enu.exe … Type = Cab Method = MSZip … If you s...
More sophisticated file command for deep inspection?
1,294,409,653,000
Let's assume that I want to run a shell script named test.sh at 1 AM every day. I could either use: 0 1 * * * /home/user/test.sh Or I could use: 0 01 * * * /home/user/test.sh For the above example, which is technically the correct answer - should a leading 0 be used in the shedule, or should just the number of the h...
If your cron accepts zero-filled numbers, you may use them. Since the POSIX specification for crontab and the crontab(5) manual on all systems that I have access to only give examples without zero-filled numbers (without actually saying anything about the formatting of numbers), it may be prudent to stay with non-fill...
When scheduling jobs to be run by crontab, should leading zeros be used for the hour?
1,294,409,653,000
The description of the bzImage in Wikipedia is really confusing me. The above picture is from Wikipedia, but the line next to it is: The bzImage file is in a specific format: It contains concatenated bootsect.o + setup.o + misc.o + piggy.o. I can't find the others (misc.o and piggy.o) in the image. I would...
Till Linux 2.6.22, bzImage contained: bbootsect (bootsect.o): bsetup (setup.o) bvmlinux (head.o, misc.o, piggy.o) Linux 2.6.23 merged bbootsect and bsetup into one (header.o). At boot up, the kernel needs to initialize some sequences (see the header file above) which are only necessary to bring the system into a de...
More doubts in bzImage
1,294,409,653,000
Lately I hit the command that will print the TOC of a pdf file. mutool show file.pdf outline I'd like to use a command for the epub format with similar simplicity of usage and nice result as the above for pdf format. Is there something like that?
.epub files are .zip files containing XHTML and CSS and some other files (including images, various metadata files, and maybe an XML file called toc.ncx containing the table of contents). The following script uses unzip -p to extract toc.ncx to stdout, pipe it through the xml2 command, then sed to extract just the tex...
Extract TOC of epub file
1,294,409,653,000
How can I get the official IANA Image Media Type (if any) of a binary stream? I'd like to avoid trusting to file extensions and vague guesses when handling images. Preferably some command using common tools like ImageMagick's identify, or some programming language if necessary.
You could use the file command. It's available on most linux distributions by default, and you can get it for Windows via the GnuWin32 file package. Call it with: $ file --mime-type clock.png clock.png: image/png Note that it's not 100% accurate - I don't think anything can be theoretically. If you want to do that ...
IANA image format string from binary stream
1,294,409,653,000
I was wondering what are some formats of object files in Linux? There are two types of object files that I know: executable, which has ELF format object files that are generated by gcc after compilation but before linkage. what is the format of such object files? Or are they also ELF format but with some different ...
Core dumps are also object files, of a sort, and usually in ELF format, too. Running this program will probably produce a file named "core": int main(int ac, char **av) { char *p = 0; *p = 'a'; return 0; } My file command says: core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4...
Different formats of object files in Linux
1,294,409,653,000
I have a bunch of files with a .zip extension that I cannot seem to extract on my HPC: $ unzip RowlandMetaG_part1.zip Archive: RowlandMetaG_part1.zip warning [RowlandMetaG_part1.zip]: 13082642473 extra bytes at beginning or within zipfile (attempting to process anyway) error [RowlandMetaG_part1.zip]: start of cen...
It turns out that, because the file is so large, zip can't handle it (it maxes out at 2Gb). Instead, I can use jar: $ jar xvf RowlandMetaG_part1.zip inflated: RowlandMetaG_part1/296E-7-26-17-O_S23_L001_R1_001.fastq.gz # etc...
Unix unzip is failing but Mac Archive Utility works
1,294,409,653,000
I have a local static variable, something like this: void function(void) { static unsigned char myVariable = 0; ... I dump the symbol table using readelf as follows: readelf -s myprogram.elf and I get the symbol table, that contains myVariable as follows: ... 409: 00412668 1 NOTYPE LOCAL DEFAULT 16 m...
That's not an artifact of readelf's output; myVariable.9751 is really that symbol's name. In order to distinguish static variables defined in different scopes/functions, the compiler has to decorate their names in some way: $ cat a.c static int var; int foo(void){ static int var; if(var++ > 3){ static ...
What is the number in readelf symbol table name?
1,294,409,653,000
I have a .CSV file which upon passing the file test_file.csv command gives the output as: test_file.csv: ISO-8859 English text, with CR line terminators When I am using cat, head or tail command on the file, it is returning me the total file content on the screen. How do I convert the line terminators so that I will ...
The only thing I'm aware of that commonly used a bare CR as a line terminator is old Mac systems (before Mac OS X) but unless it's a really old file that seems unlikely. In any case the mac2unix program in the dos2unix package should be able to fix it for you.
Unable to do head or tail for a file
1,294,409,653,000
How can I convert (or open) .ost file (Microsoft Outlook email folder) on linux ? Ideally, I would like to read it with Mutt. But mutt does not seem to understand this format. Therefore I would like to convert it into something readable such as mbox or mdir format. Are there such conversion tools on linux ?
There are a few tools which help with interoperability with Outlook files: libpff, which includes a pffexport program which can extract data from OST (and other) files; Evolution has a PST import plugin which can handle OST files; libpst, which can convert PST files to mbox files, but I don’t know whether it can hand...
how to open/convert .ost file (Microsoft Outlook email folder) on linux
1,294,409,653,000
I ran into a problem on busybox where my /etc/group file was not properly processed. bash> tail /etc/group ... onebutlast::1001:user1,user2 last::1002:user3bash> The user3 was not in the last group according the the getgrouplist function. Verifying the man group page: The /etc/group file is a text file that de...
A "line" is by definition a string of text terminated by a newline. By extension of this definition, a file is not a "text file" if it does not end with a newline character. That's what POSIX says. That standard does however not care about the /etc/group file as such (the group database may be stored in any sort of d...
Is it ok to have no newline at end of /etc/group?
1,294,409,653,000
Modem Manager GUI creates a database named sms.gdbm to store all the SMS details. Currently Modem Manager GUI is not providing a feature to simply delete all received/sent messages. So I'm trying to create a program to remove those records from its database (sms.gdbm). But first I want to know the structure of the sms...
GDBM databases are readable through the GDBM API. They are basically a way to store simple key-value pairs of any kind. There is no "structure" as in traditional DBMSes : no tables, no columns... Only keys and values. The API defines the following functions: GDBM_FILE gdbm_open (const char *name, int block_size, int f...
How to get the structure of a GDBM database
1,294,409,653,000
I created a username/password combination of the form onetwo:bucklemyshoe, ie the password file contains the single line onetwo|bucklemyshoe Whenever I try to connect the message appears on the logon page: You were disconnected for the following reason: invalid challenge response The logs display the following mess...
According to the xpra mailing list where this was also asked, the password file format is documented on the wiki: Password File "file" vs "multifile": "file" contains a single password, the whole file is the password "multifile" contains a list of authentication values, see proxy server file authentication - this mo...
What is the correct format for xpra password files?
1,294,409,653,000
On Linux, each software can decide the configuration format he wishes to use. Some uses TOML, INI, JSON, XML, CSV, YAML, JS, CSS, scripts, and so on. However, some configuration files use kind of INI-like text formats, which seem non-standard, e.g. : A text file in which each line is composed of a key and a value sepa...
"Text-based configuration format, with weak structural hierarchy" is what I'd call the common denominator of both examples. An nginx config file is syntactically as different to an SSH config file as it is to JSON – it might look similar on a cursory glance, but the things both parsers can do with the content of the f...
Is this type of Linux configuration files format has a name or a way to designate them?
1,294,409,653,000
When tried the command cat < 1.pdf it printed a very large output, which was totally incomprehensible to me. The content of 1.pdf was abc. The output was like this: ÀýÓëöûcÎ=ÉÐÎTaüÍ8]ö¹mg:=Rú*@H1S¢▒ùá½~Ì8u_4,¬7ïy­t#¯ÚZ|åôÛ~«Æ fM²JKÁNÿ6 ì©ìÞ¾▒bT ¦åÊmBíöÖ¡÷ÄïÝM{Í1¹@;ÄqÄú t]È7DJ Êûc0£jÜÖã­\0O8À±(2)èJR'Ø...
If you call cat on a file containing a text in Chinese¹, it won't print out an English translation. With computer formats, it's the same thing: if you call cat on a file containing data in a certain format, it won't translate it to another format such as plain text. That's not its job: its job is to copy its input to ...
Why 'cat' can't read content of pdf files?
1,294,409,653,000
Please let me know if below two statements are correct or not: Folder /usr/share/mime/magic has a database/table that will give me what are the current possible file formats (outputs that I can get when I type the file command and follow it by a file name). Whenever the file command output contains the word "text" it...
Folder /usr/share/mime/magic has a database/table that will give me what are the current possible file formats (outputs that I can get when I type "file" command and follow it by a file). Correct except that /usr/share/mime/magic is not the directory that file uses: this file is only used for the MIME type database....
File command database and identifying text files
1,294,409,653,000
ELF 'Executable and Linkable Format' So if I generate Shared Object files .so are those considered ELF files?
Yes, if you generate them on linux for native use. You can see this via file: > file mylib.so mylib.so: ELF 64-bit LSB shared object [...]
Are .so files in Fedora considered ELF files?
1,409,882,382,000
I have a directory containing a large number of files. I want to delete all files except for file.txt . How do I do this? There are too many files to remove the unwanted ones individually and their names are too diverse to use * to remove them all except this one file. Someone suggested using rm !(file.txt) But it d...
POSIXly (without -delete, -mindepth etc.): find . ! -name 'file.txt' -type f -exec rm -f {} + will remove all regular files (recursively, including hidden ones) except any files called file.txt. To remove directories, change -type f to -type d and add -r option to rm; care must be taken to avoid deleting any parent d...
Remove all files/directories except for one file
1,409,882,382,000
I want to see what files will be deleted when performing an rm in linux. Most commands seem to have a dry run option to show just such information, but I can't seem to find such an option for rm. Is this even possible?
Say you want to run: rm -- *.txt You can just run: echo rm -- *.txt or even just: echo *.txt to see what files rm would delete, because it's the shell expanding the *.txt, not rm. The only time this won't help you is for rm -r. If you want to remove files and directories recursively, then you could use find instead...
How do you do a dry run of rm to see what files will be deleted?
1,409,882,382,000
Can I completely disable "Recently Used" feature in GTK's file / directory selector? Sometimes programs default to this but since it's not useful in my work-flow and with the way I organize my files, it only adds confusion: I usually just expect to start from my $HOME, so I get surprised by the list of folders Also ...
@MartinVegter There is a file ~/.config/gtk-2.0/gtkfilechooser.ini. It should look like Stefano wrote: [Filechooser settings] LocationMode=path-bar ShowHidden=false ShowSizeColumn=true GeometryX=377 GeometryY=132 GeometryWidth=612 GeometryHeight=528 SortColumn=name SortOrder=ascending StartupMode=recent There was no ...
Disable "Recently used" in GTK file/directory selector
1,409,882,382,000
I have several utility programs that do not have their own directory and are just a single executable. Typically I put the binary in /usr/local/bin. A problem I have is how to manage preference settings. One idea is to use environment variables and require the user to define such variables, for example, in their bash....
Small utilities for interactive desktop use would be expected to follow the XDG Base Directory Specification and keep their config files under $XDG_CONFIG_HOME or (if that is empty or unset) default to $HOME/.config The picture is a little less clear for non-GUI tools, since they might run on systems which are headl...
Where should small utility programs store their preferences?
1,409,882,382,000
I have two backup directories (dir1 and 2) on two different (local) HDDs and I want to create one of them. How can I really sync their contents so that both directories will have the same contents?
To sync the contents of dir1 to dir2 on the same system, type: rsync -av --progress --delete dir1/ dir2 -a, --archive         archive mode --delete         delete extraneous files from dest dirs -v, --verbose         Verbose mode (increase verbosity) --progress         show progress during transfer         ...
How can I sync two local directories? [duplicate]
1,409,882,382,000
Usually, I unarchive things by $ mkdir newFolder; $ mv *.zip newFolder; $ cd newFolder; $unzip *.zip but sometimes I get lazy and just do in an arbitrary folder $ unzip *.zip so time-to-time messing up with other content. I will list here some methods -- some archive version surely have crappy-flags while others more...
By name You can generate the list of files in the archive and delete them, though this is annoyingly fiddly with archivers such as unzip or 7z that don't have an option to generate a plain list of file names. Even with tar, this assumes there are no newlines in file names. tar tf foo.tar | while read -r file; do rm --...
How to de-unzip, de-tar -xvf -- de-unarchive in a messy folder?
1,409,882,382,000
Is there a nice alternative for this? I always use du -shc * to check the size of all files and folders in the current directory. But it would be nice to have a colored and nicely formatted view (for example like dfc for viewing the sizes of partitions).
This is not coloured, but also really nicely ordered by size and visualized: ncdu - NCurses Disk Usage apt-get install ncdu SYNOPSIS ncdu [options] dir DESCRIPTION ncdu (NCurses Disk Usage) is a curses-based version of the well-known 'du', and provides a fast way to see what directories ar...
Alternative command for coloured viewing the size of all files and folders
1,409,882,382,000
I have a large music collection stored on my hard drive; and browsing through it, I found that I have a lot of duplicate files in some album directories. Usually the duplicates exist alongside the original in the same directory. Usually the format is filename.mp3 and duplicate file is filename 1.mp3. Sometimes there m...
There is such a program, and it's called rdfind: SYNOPSIS rdfind [ options ] directory1 | file1 [ directory2 | file2 ] ... DESCRIPTION rdfind finds duplicate files across and/or within several directories. It calculates checksum only if necessary. rdfind runs in O(Nlog(N)) time with N being the numbe...
Search and Delete duplicate files with different names
1,409,882,382,000
I have a daily backups named like this: yyyymmddhhmm.zip // pattern 201503200100.zip // backup from 20. 3. 2015 1:00 I'm trying to create a script that deletes all backups older than 3 days. The script should be also able to delete all other files in the folder not matching the pattern (but there would be a switch fo...
The first problem in your code is that you are parsing ls. This means it will break very easily, if you have any spaces in your file or directory names for example. You should use shell globbing or find instead. A bigger problem is that you are not reading the data correctly. Your code: ls -1 | while read A DATE B FIL...
How to delete old backups based on a date in file name?
1,409,882,382,000
Is there a way to make git handle a symlink as if it was a file. If I just normally add a symlink like git add symlink, git just stores/controlls the path to the file, not the linked file. Is it possible to make git handle a symlink as if it was the linked file itself?
Sounds like you want a hard link ln sourcefile /some/git/repo/targetfile Only any good if the source and target locations are within the same file system. Otherwise you’ll have to settle for a copy or a symlink. A symlink is a reference to a file. A hard link is another name for an existing inode. There are numerous ...
Git - handle symlink as if it was a file
1,409,882,382,000
I have a file named 'sourceZip.zip' This file ('sourceZip.zip') contains two files: 'textFile.txt' 'binFile.bin' I also have a file named 'targetZip.zip' This file ('targetZip.zip') contains one file: 'jpgFile.jpg' In linux, what bash command shall I use to copy both files ('textFile.txt', 'binFile.bin') from the so...
Using the usual command-line zip tool, I don't think you can avoid separate extraction and update commands. source_zip=$PWD/sourceZip.zip target_zip=$PWD/targetZip.zip temp_dir=$(mktemp -dt) ( cd "$temp_dir" unzip "$source_zip" zip -g "$targetZip" . # or if you want just the two files: zip -g "$targetZip" textFi...
Copy a File From One Zip to Another?
1,409,882,382,000
I want to put a script in cronjob which will run in a particular time and if the file count is more than 60, it will delete oldest files from that folder. Last In First Out. I have tried, #!/bin/ksh for dir in /home/DABA_BACKUP do cd $dir count_files=`ls -lrt | wc -l` if [ $count_files -gt 60...
No, for one thing it will break on filenames containing newlines. It is also more complex than necessary and has all the dangers of parsing ls. A better version would be (using GNU tools): #!/bin/ksh for dir in /home/DABA_BACKUP/* do ## Get the file names and sort them by their ## modification time file...
How to delete files from a folder which have more than 60 files in unix?
1,409,882,382,000
I have a directory with over 400 images. Most of them are corrupt. I identified the good ones. They are listed in a text file (there're 100+ of them). How can I move them all at once to another directory on BASH?
There are several ways to do this that come to mind immediately: Using a while-loop Using xargs Using rsync Suppose the file names are listed (one per line) in files.txt and we want to move them from the subdirectory source/ to the subdirectory target. The while-loop could look something like this: while read filena...
How to move files specified in a text file to another directory on BASH? [duplicate]
1,409,882,382,000
Suppose that I have a file called temp.txt. Using the cat program, I would like to add the contents of this file to the end of myfile.txt -- creating myfile.txt if it does not exist and appending to it if it does. I am considering these possibilities: cat temp.txt > myfile.txt or cat temp.txt >> myfile.txt Both ...
> writes to a file, overwriting any existing contents. >> appends to a file. From man bash: Redirecting Output Redirection of output causes the file whose name results from the expansion of word to be opened for writing on file descriptor n, or the standard output (file descriptor 1) if n is not specified. If the...
What is the difference between > and >> (especially as it relates to use with the cat program)? [duplicate]
1,409,882,382,000
I would like to concatenate multiple files following a specific order from an other file. I have multiple files called freq_<something> that I want to concatenate. The "something" are listed in another file called "list". So here is my list: $ cat list 003137F 002980F 002993F I want to do: cat freq_003137F freq_00298...
You can do it with a while, why not? This should work: while read suffix; do cat freq_"${suffix}"; done < list > freq_all; done Alternatively, you can generate the command with printf and run it manually: $ echo "cat $(printf 'freq_%s ' $(cat list)) > freq_out" cat freq_003137F freq_002980F freq_002993F > freq_out O...
Concatenate files using a specific order based on another file
1,409,882,382,000
On my Gentoo box running without a desktop environment, every time I try to open a file the system tries to open it with Firefox. I understand that without a desktop environment "open file" cannot function correctly, but why is everything opened with Firefox? If I want to, can I change it to something else?
Usually this information is handled in 2 places: Application .desktop files advertise what program can open MIME database which specifies what application should be used to open file with specific MIME The MIME database can be customized by editing .local/share/applications/mimeapps.list and .local/share/application...
Gentoo default application for opening files
1,409,882,382,000
I have a set of files with prefix, say "pre_", on a Linux machine and I just want to rename all of these files by removing that. Here is the perl code I wrote it doesn't throw any errors, but the work is not done. #!/usr/bin/perl -w my @files = `ls -1 | grep -i \"pre_.*\"`; foreach $file ( @files ) { my @names = spl...
You aren't executing anything. When you put something in single quotes (''), that's just a string, so 'mv "$file" "$var1"' is not a command, it's a string and doesn't do anything. A string by itself is just a true statement. In order to execute the command, you need to use: system "mv", "--", $file, $var1; (Not syste...
Renaming files in Linux using perl scripting
1,409,882,382,000
Well to put it simply, I have duplicate files in a folder, with this form: file.ext file(1).ext file(2).ext file(3).ext otherfile.ext otherfile(1).ext otherfile(2).ext ... I want to move only file.ext and otherfile.ext to another folder. Is it possible to do it in bash? I thought that maybe awk would be helpful?
In bash: shopt -s extglob # activates extended pattern matching features mv !(*\(+([0-9])\)).ext /path/to/target/ The regular expression matches all files, that don't end with (n).ext, where n is one or more numbers: +([0-9]). You can check it with echo: echo !(*\(+([0-9])\)).ext Prints: file.ext otherfile.ext
Move unique files from a folder with duplicates files
1,409,882,382,000
I've tried using answers given on here, and it doesn't seem to be working. Below are the commands I tried to remove all files with the index.php prefix in this directory on my CentOS system. The first two seem to have run but didn't do anything? $ find . -prune -name 'index.php.*' -exec rm {} + $ find . -prune -name '...
Lets assume we have this test data set of test files: $ tree . ├── index.php ├── index.php.bar ├── index.php.foo ├── keppme.php └── level1 ├── index.php ├── index.php.l1 ├── keepme.php └── level2 ├── index.php ├── index.php.foo └── keepme.php Delete all files starting with inde...
Removing multiple files with same prefix (argument list too long)
1,409,882,382,000
I am backing up files, and I have a lot of files duplicated in multiple locations. I've used fdupes to find duplicates, but I'm actually looking for some sort of inverse of this tool. I want to see if dir A and its sub directories contain any file that dir B does not contain. I'd like to see a list of files, if that ...
You could try: diff --brief -r dir1/ dir2/ > logoutputtoafile.log Remove --brief if you wish more detail.
Find unique files between two directories (recursively)
1,409,882,382,000
Rookie question. Following this answer Move last part of filename to front, I'm trying to do the same, except all files in my case contains square brackets. What I want is to move the title to the other side of the brackets (keeping the file extension), so this: title ![s2_e2].mp4 renames to this: [s2_e2]title !.mp4 ...
If I understand correctly, you need to move any text inside square brackets to the beginning of the file name. Assuming you only ever have one set of square brackets in the file name, you can do: rename -n 's/(.*)(\[.+?\])/$2$1/s' * Running this on your example gives: $ rename -n 's/(.*)(\[.+?\])/$2$1/s' * title ![s2...
Rename file with the rename tool - moving around square brackets
1,409,882,382,000
I have one parent directory /home/test and under that directory I have multiple directories. The names are server{1..10} and one of them server3 has few files which I have copied from remote server. I tried to use cp but it's not working for me. Is there a way to copy all files or one file from server3 directory to...
If I'm understanding what you're after, the easiest way is a for loop: myList="server1 server2 server4 server5 server6 server7 server8 server9 server10" for myDir in $myList ; do cp server3/* $myDir/ ; done
Copying all files from one directory to all directories under same parent directory
1,409,882,382,000
I have a folder called movies on my Ubuntu, which contains many subfolders. Each subfolder contains 1 mp4 file and may contain other files (jpg, srt). Each subfolder has the same title format: My Subfolder 1 (2001) Bla Bla My Subfolder 2 (2000) Bla My Subfolder 3 (1999) How can I rename the mp4 files same as parent f...
Here's a bash solution: cd movies for mp4 in */*.mp4 do if [[ $mp4 =~ ^(.*)\ \( ]] then echo mv -- "$mp4" ...to... "${mp4%%/*}/${BASH_REMATCH[1]}".mp4 fi done This loops over every mp4 file in every subdirectory of "movies" and applies a pattern-matching test to it. If it matches: ^ - from the beginning (...
How to rename files with same name as parent folder
1,409,882,382,000
It's surely easy to do while using a graphical environment, but when I'm using the shell I have no idea on how to do that, I already tried to use copy, move, delete, and I discovered that these word are not existent commands on the shell.
These are: Copy: cp file_name <directory|file_name> Move: mv file_name <directory|file_name> Delete: rm file_name Visit their man pages for more information.
How to copy/move/delete files from the shell?
1,409,882,382,000
I have a number of files in a folder on a Linux machine with the following names: 11, 12, 13, 14, 15, 21, 22, 23, 24, 25, 31, 32, 33, 34, 35 I would like to use regex in order to rename with the .inp extension I tried mv * *.inp mv: target '*.inp' is not a directory which provided an error. I also tried using the re...
The issue with your command is that the mv command only can move/rename a single file (when given exactly two command line arguments), or move a bunch of files to a single destination directory (more than two command line arguments). In your case, you use the expansion of * *.inp as the arguments, and this is going to...
Renaming files using regex
1,409,882,382,000
I am trying to come up with a bash script to remove parts of a file name on CentOS. My file names are: 119903_Relinked_new_3075_FileNote_07_02_2009_JHughes_loaMeetingAndSupport_FN_205.doc 119904_relinked_new_2206_Support_Intensity_Scale_SYCH_SIS_264549.pdf 119905_relinked_new_3075_Consent_07_06_2009_DSweet_CRFA_CF_165...
Using the prename(1) tool (it might be called rename or prename or perl-rename depending on your system): rename 's/[0-9]+_[rR]elinked_new_//' /path/to/dir/* This will use a regular expression to match the pattern and replace it with nothing on the specified files.
Script to remove specific strings in file name
1,409,882,382,000
I'm following a tutorial on how to install firmware on OpenBSD. The tutorial has me creating a new msdos file system on the usb with: newfs_msdos -F 32 /dev/rsd2c then to take usb to a system with an internet connection, then move the firmware tarball into the USB. I have never moved data to a msdos fs via the command...
The message failed to preserve ownership for '/mnt2/iwn-firmwae.tgz': Operation not permitted is more of a warning than an error. The files copied successfully, but permissions and ownership of the files were not copied. Most likely this is a DOS filesystem which does not support unix ownership and permissions. Fo...
Error: "failed to preserve ownership" when trying to move files to a FAT32 partition on OpenBSD
1,409,882,382,000
I have a directory that has files in it that are named 'o1.ray' to 'o293.ray'. I want to move them to an another directory while renaming them 'o132.ray' to 'o424.ray'. How can I do this in the terminal? cd directory for i in {1...293}; do cp o$i.ray subdirectory/o$i+131.ray; done I know this is wrong because I get: ...
As Kusalananda hinted at, this is mostly an adjustment of syntax: for index in {1..293}; do echo mv o"${index}".ray subdirectory/o"$((index+131))".ray; done Remove the echo when the output looks correct. Or, with zsh's zmv module: autoload zmv zmv -n 'o(<->).ray' 'subdirectory/o$[$1 + 131].ray' The $[ ... ] syntax ...
How to rename files with sequential names to an another sequence using Terminal?
1,409,882,382,000
Suppose I have same version of linux kernel but I changed some driver lines. Is there any way to compare these kernels and list the results. The result would be helpful to go back if I changed a lot in original drivers.
The traditional method: diff -r dir1 dir2 That gives you a file-by-file difference, which can be kind of wordy. If you have Gnu diff, you can try: diff -r --brief dir1 dir2
Compare two similar directories and list differences between files
1,409,882,382,000
I had about 170 MiB free space in my Raspberry Pi so I decided to delete the .deb packages (about 800 MiB) in /var/cache/apt. I opened sudo pcmanfm, selected the files and pressed the delete button (not shift+delete). The files were gone, but the free space did not increase. The pcmanfm window with elevated privileges...
The following command will print all debian packages found on the system: sudo find / -type f -iname "*.deb" this will delete them: sudo find / -type f -iname "*.deb" -exec rm -v {} \; If the free space did not increase, then where did the files go, and how to delete them properly? PCManFM's trashcan location is...
Free space does not increase even after deleting
1,409,882,382,000
I have a nautilus script that generates an archive file based on the files selected in the nautilus window. This archive file is created in the /tmp directory. I want a way to copy this file to the clipboard from the script, so that the user can just go to desktop or home directory and paste it. I have tried doing thi...
It seems that Nautilus keeps track of it's internal state with respect to changes to the clipboard, which means that any change of state to the clipboard (including replacement with an identical filepath string) automatically cancels the paste pending state, hence nothing happens when an externally loaded clipboard co...
Copy a file from a nautilus-script to clipboard
1,409,882,382,000
I have many files which contain a string like this: /databis/defontis/Dossier_fasta_chrm_avec_piler/SRR6237661_chrm.fasta: N putative CRISPR arrays found Where the N is a number that can be either 0 or greater. I need to move all files where the N is 0 to the directory Sans_crispr and all files where N is greater tha...
Simply iterate over the files, and grep for : 0 putative CRISPR regions. If the grep finds a match, move the file: mkdir -p Sans_crispr Avec_crispr for file in *pilercr.out; do if grep -q ': 0 putative CRISPR arrays' "$file"; then mv "$file" Sans_crispr else mv "$file" Avec_crispr fi done ...
How can I move files to different directories depending on their contents?
1,409,882,382,000
I want to download .jpg/.png/.tiff files into my ~/Pictures/ folder, .mkv/.avi/.mp4 in my ~/Videos folder etc. Is there anyway to do this? the only solution I could come up with was using different aliases like : alias vwget="wget -P ~/Videos/" I am using Linux Mint.
I would just do this in two steps: Download everything into one directory, preferably on the same file system as your ~/Pictures and ~/Videos directories so you don't need to use any more space. Once they have downloaded, cd into the download directory and run these commands: mv *.jpg *.png *.tiff ~/Pictures mv *mkv ...
Using wget to download files to specific folders based on file extension
1,586,785,493,000
How can I delete many folders that have more than one - in their names? For example: e97bf913-5759-4fff-bdaf-2f931b53a432/ 39f953c5-dab0-420e-a650-a50a30f48097/
The pattern *-*-*/ matches directories with two or more hyphens. The * matches any string (zero or more characters). If you want to only match directory names that should not start and end with a hyphen (as in your example), you could use [!-]*-*-*[!-]/ instead. The [!-] matches any character that is not (!) a hyp...
Delete set of folders contain more than one '-' in different places as a part of their name
1,586,785,493,000
I'd like to rename the recon.text file with its directory name. I have 1000 directories. Some help, please? 7_S4_R1_001_tri10_sha/recon.text 8_S1_R1_001_tri15_sha/recon.text 9_S8_R1_001_tri20_sha/recon.text 10_S5_R1_001_tri25_sha/recon.text 11_S3_R1_001_tri30_sha/recon.text
With rename: rename -n 's!(.*sha)/recon\.text!$1/$1.txt!' */recon.text Remove -n switch when the output looks good to rename for real. man rename There are other tools with the same name which may or may not be able to do this, so be careful. The rename command that is part of the util-linux package, won't. If you ...
How to rename files with the name of their parent directory?
1,586,785,493,000
I am traversing through directories and moving old files to a different location. For eg. a file located in path /a/b/c/d.txt I want to move to /x/a/b/c/d.txt without errors. Is it possible in a single command? If mv doesn't work , then combination of cp and rm will work? Only need to move single file at a time. If ...
Possibly not what you are looking for, if you need to use standard commands only, but rsync may help: $ mkdir a a/b a/b/c; echo foo >a/b/c/d.txt; tree a a └── b └── c └── d.txt 2 directories, 1 file $ rsync --relative --remove-source-files a/b/c/d.txt x/ $ tree a x a └── b └── c x └── a └── b ...
move one file from /a/b/c/d.txt to /x/a/b/c/d.txt , Create full tree if not exist [duplicate]
1,586,785,493,000
I have a directory that has subdirectories in it and I need to get the names of some of these subdirectories but there is one with a similar pattern as them that I want to ignore. For example, if the list of Subdirectories is like this: Name_One Not_needed1 Name_Two Name_Three Not_needed2 Name_Zero I want to store th...
try: find . -type d -name 'Name_*' ! -name 'Name_Zero' for the directories name of Name_[digit] and exclude only directory Name_0. find . -type d ! -name 'Name_0' -regex './Name_[0-9]*' in case you had subdirectors too, use this: find . -type d ! -name 'Name_0' -regex '.*/Name_[0-9]*' the regex above matches the di...
Find a file by pattern but ignore others with similar patterns
1,586,785,493,000
I have a symlink to a file on my Ubuntu system, and I need to copy the original file to a different directory and have a new name there. I am able to copy it to a different directory using readlink -ne my_symlink | xargs -0 cp -t /tmp/ But I am not able to give a new name in the destination directory. Basically, I a...
cp will dereference symlinks with -L option. This should work: cp -L my_symlink /tmp/newnametofile Regarding your xargs, -t, --target-directory option of cp only takes DIRECTORY as input. You could make it work using xargs -I{} cp {} /tmp/newnametofile (but I'd use cp -L anyways...
copying a symlink to a target file using cp -t
1,586,785,493,000
I have a series of files located in a series of folder, for example: ~/BR2_1-3/bin.1.permissive.tsv ~/BR2_1-3/bin.2.permissive.tsv ~/BR2_1-3/bin.3.orig.tsv ~/BR2_2-4/bin.1.strict.tsv ~/BR2_2-4/bin.2.orig.tsv ~/BR2_2-4/bin.3.permissive.tsv ~/BR2_2-4/bin.4.permissive.tsv ~/BR2_3-5/bin.1.permissive.tsv ~/BR2_3-5/bin.2.pe...
find and xargs are typically recommended for this: find "$HOME" -name \*.tsv | xargs awk -F'\t' -v OFS='\t' '$5 != "" {print $1, $5}' >> output.tsv or, more safely find "$HOME" -name \*.tsv -print0 | xargs -0 awk -F'\t' -v OFS='\t' '$5 != "" {print $1, $5}' >> output.tsv find's -print0 directive prints out the m...
Use For loop to extract certain columns from a series of files to write new tab-delimited files
1,586,785,493,000
I've been testing this on a simple directory structure. I'm trying to change any directory and/or sub directory with the name "Season" to "Sn". I got to a point where the script would change what I wanted...except for the top directory, as seen in the list below - "Season 1" "Season 2" "Season 3". Directory structure:...
The issue is that you are not creating an array, you are creating a string. You can test this quite easily by attempting to print the first element of your array: $ array="$(find . -maxdepth 2 -type d -iname 'Season*' -print)"; $ echo $array ./Season 3 ./Season 1 ./Season 2 Looks good right? But if that were an arra...
Renaming directory bash script - target ... No such file or directory
1,586,785,493,000
Where to begin to diagnose the problem? I don't even know where to begin to look. I'm practicing string and file wrangling, and I cannot get sed '$d' file.sh to delete the last line of a file; furthermore, I tried using sudo (also this did not work). My source says my command should work. I know that you can use thin...
sed (a command from the 70s) is a stream editor, it's not meant to edit files. See ed, ex, vi for file text editors. sed takes a stream on input either stdin or the contents of files if some are passed as arguments, processes them on the fly applying the commands in the sed script for each line matching the address(es...
Why is `sed '$d' file` not deleting lastlines?
1,586,785,493,000
Is there a means of using rsync to sync two folders? I would like to shoot photos in JPG and RAW. Since viewing JPGs is much quicker than opening up RAWs, I'd like to do culling in the JPG folder and then sync it to the RAW folder. However they contain different extensions but the same file name. I realize that the mo...
in general, if you have similar filename that changes in some particular place, you can set those differences in [] brackets: ruslanas@ruslanas test]$ ls a.jpg a.raw a.doc [ruslanas@ruslanas test]$ ls a.{jpg,raw} a.jpg a.raw [ruslanas@ruslanas test]$ or just use asterisk if you have only jpg and raw extension an...
How to sync two folders with the same file names but different extensions
1,586,785,493,000
Accessing these locations from Windows times out or. in worse case, hangs until restarting smbd. Accessing them via SSH hangs until the connection is closed. I forcefully checked the RAID5 array where the troublesome directories are but it didn't find anything besides a lot of 'extent tree could be narrower' (which a...
According to dmesg, the problem was caused by one of the member drives beginning to fail (sector fault). After removing the failing drive, the array is working normally again.
Accessing certain locations on a home server, hangs/times out. How can I find the cause and fix it? [closed]
1,586,785,493,000
File names : _10_-_Overriding_or_customizing_the_rest_end_point-rkkfgI502f0.mp4 _11_-_Expose_ids_in_json_response-CrDXtLfiZos.mp4 _12_-_Create_angular_8_project_using_Angular_CLI-kSXkW1hF0KU.mp4 _13_-_Create_a_model_class_for_Book_entity-Hfm3da1Ze8E.mp4 _14_-_Display_the_list_of_books_in_html_table_with_hard-coded_val...
In the directory that contain those files, issue for file in _*; do mv "$file" "${file#_}"; done ${file#exp} deletes the shortest match of the pattern exp from the beginning of file.
Removing a single character from the beginning of file names
1,586,785,493,000
This is weird: $ ls -l 'Lana Del Rey - Blue Jeans (Remastered 2011).mp3' -rw-rw-r-- 1 gigi gigi 4.0M Dec 11 23:06 'Lana Del Rey - Blue Jeans (Remastered 2011).mp3' $ find . -name 'Lana Del Rey - Blue Jeans (Remastered 2011).mp3' ./Lana Del Rey - Blue Jeans (Remastered 2011).mp3 # but still in the same directory: $ f...
This is for essentially the same reasons as discussed here: find does not work on symlinked path? In particular, find does not traverse symlinks by default - and (at least assuming you are using the bash shell) neither does the builtin pwd command. You have a number of options to make the behavior with pwd the same ...
Why existing file is not found with find with `pwd` but is found with find dot?
1,586,785,493,000
How can I move everything but the last n files, from dir1 to dir2?. I currently do this, setting the time as an approximate for n, in my case n=2 each 10 minutes. find /dir1/ -name '*.txt*' -mmin +10 -type f -exec mv "{}" /dir2/ \; A similar command, could work, but i am not certain, could somebody confirm how shoul...
With zsh: mv dir1/**/*.txt*(D.om[3,-1]) dir2/ Would move the regular files in dir1 except for the 2 most recently modified ones to dir2. **/: any level of sub-directory. D: include hidden files and descend into hidden dirs. .: only regular files (no symlink, directory...), equivalent for find's -type f. om: sort by ...
How to move everything but the last files?
1,586,785,493,000
I had a 1000's of text files on a Linux machine, and each text file's name has a prefix (OG00*) and contains 9 unique IDs. I want to create one text file for each of these IDs with text file names - OG0012637_1.txt, OG0012637_2.txt, OG0012637_3.txt, OG0012637_4.txt, OG0012637_5.txt....OG0012637_9.txt Input: $ cat OG0...
If you don't have access to the GNU implementation of split, then with awk: awk ' FNR==1 { basename = substr(FILENAME,1,length(FILENAME)-4) } { outfile = basename "_" FNR ".txt"; print > outfile; close(outfile) } ' OG*.txt
How do I split and name the text file (based on the no. of lines of content) for bigdata?
1,586,785,493,000
I'm new to Linux and trying multiple variants of Ubuntu (standard, Mint, Pop, etc.). Unfortunately, every OS is isolated on different partitions, with separate settings, user groups, etc. and programs have to be installed each time I install a new OS. I would like to have a primary OS (Ubuntu LTS) and then all subsequ...
Is this possible? No. You can share user settings easily buy creating a separate partition for /home and mounting it in all your used OSes. And if you have different /homes you can use symlinks. however, sharing programs doesn't make any sense whatsoever (different distros may use different versions of applications,...
Can multiple operating systems share profiles and programs?
1,586,785,493,000
I'm using KDE Plasma, and frequently need to package file sets into tar.gz or zip. This usually requires opening Ark, creating a new file, and working from there, which is a run-around. It would be better if I could right-click in the Dolphin workspace for a directory, go the "Create New..." submenu, and pick this fil...
It's apparently necessary to add a .desktop file to /usr/share/templates or ~/.kde4/share/templates. In the latter case, the templates folder should be created if necessary. See Adding an entry to the Create New menu in the KDE UserBase Wiki for more info.
How can I add custom entries to "Create New" on KDE Plasma?
1,586,785,493,000
I have a folder with ~6000 files (some of the are .txt and some .pdf files) and I am trying to organize them in different folders. folder looks like this: $ ls ./res-defaults ML3020T1--ML3020N_chr6-209980-34769899-LOH_clusters.pdf ML3020T1--ML3020N_chrom_clust_freqs.txt ML3020T1--ML3020N_cluster_summary.txt ML3020...
You can use awk to print the 4th and 9th fields: $ awk '{print $4,$9}' meta.data 81-52884T DL_M ML3020T1 ML_K 10-24757T CL_GC HTMCP-01-01-00451-01A-01D DL_HTMCP Next, pass that to read and assign each field to a variable. Then, create the target directories (use mkdir -p so that it won't complain if the directorty al...
moving files into different directories based on their names matching with another file
1,586,785,493,000
I am using Linux and I want to write a shell script that takes two directories and moves the second directory in the first one (so the second directory becomes a subdirectory of the first one) and all the files from the second directory become ".txt" extension. For exemple: dir2 contains: file1 file2 dir3 file3.jmp A...
You're not moving or referencing dir2. Try something like this: #!/bin/sh mv "$2" "$1" || exit # Make $2 a subdirectory of $1 cd "$1/$(basename "$2")" || exit # Change directories for simplicity for f in *; do mv "$f" "${f%.*}.txt" # Add or change the extension done Adding || exit a...
How to change the extension of all files from a directory?
1,586,785,493,000
I'm trying to upload all files in a directory to s3 using dates in the filenames as parameters to create the s3 locations. Here's what I have so far. for file in /home/ec2-user/clickparts/t*; do year="${file:9:4}" month="${file:14:2}" day="${file:17:2}" aws s3 cp "$file" s3://mybucket/json/clicks/clic...
Given a file "the_date=2017-05-04", your for loop will set the file variable to /home/ec2-user/clickparts/the_date=2017-05-04. If you take 4 characters from the 9th character, you get -use, which is what you see where your year variable is used. One way to fix this is to take account of the number of characters in yo...
Use substrings of filename as parameters in for loop that builds aws command
1,586,785,493,000
I need to rename a bunch of files (more than 100) on an Ubuntu system, and want to know how to I do that when the pattern of the files is something like "Filename_01.jpg" to "NameOfFile_01.jpg" In Windows, I would type: ren Filename_*.jpg NameOfFile*.jpg Because of the convoluted way the various commands I have foun...
One approach (depending on the distro the rename will have a different syntax, this is from the default in the debian family): tink@box1:~/tmp$ ls ranting filename_17.jpg filename_27.jpg filename_37.jpg filename_47.jpg blub filename_18.jpg filename_28.jpg filename_38.jpg filename_48.jpg ds_w...
How to rename files in Linux like the ren command in Windows
1,404,054,539,000
Suppose I have a PDF and I want to obtain whatever metadata is available for that PDF. What utility should I use? I find the piece of information I am usually most interested in knowing is the paper size, something that PDF viewers usually don't report. E.g. is the PDF size letter, legal, A4 or something else? But the...
One of the canonical tools for this is pdfinfo, which comes with xpdf, if I recall. Example output: [0 1017 17:10:17] ~/temp % pdfinfo test.pdf Creator: TeX Producer: pdfTeX-1.40.14 CreationDate: Sun May 18 09:53:06 2014 ModDate: Sun May 18 09:53:06 2014 Tagged: no Form: none Pa...
Discovering metadata about a PDF
1,404,054,539,000
I am writing a bash script that I want to echo out metadata (length, resolution etc.) of a set of videos (mp4) into a file. Is there a simple way to get this information from an MP4 file?
On a Debian-based system (but presumably, other distributions will also have mediainfo in their repositories): $ sudo apt-get install mediainfo $ mediainfo foo.mp4 That will spew out a lot of information. To get, for example, the length, resolution, codec and dimensions use: $ mediainfo "The Blues Brothers.mp4" | gre...
Get metadata from a video in the terminal
1,404,054,539,000
It is well-known that empty text files have zero bytes: However, each of them contains metadata, which according to my research, is stored in inodes, and do use space. Given this, it seems logical to me that it is possible to fill a disk by purely creating empty text files. Is this correct? If so, how many empty tex...
This output suggests 28786688 inodes overall, after which the next attempt to create a file in the root filesystem (device /dev/sda2) will return ENOSPC ("No space left on device"). Explanation: on the original *nix filesystem design, the maximum number of inodes is set at filesystem creation time. Dedicated space is...
Can I run out of disk space by creating a very large number of empty files?
1,404,054,539,000
If I export an image with lets say 300 DPI and I read out its meta-info with any application that can do it (like file, exiftool, identify,mediainfo etc.), I always get a value showing Image-Width and Image-Height. In this case: 2254 x 288 how do I get the 300 DPI value, or the corresponding value from any other image...
You could use identify from imagemagick: identify -format '%x,%y\n' image.png Note however that in this case (a PNG image) identify will return the resolution in PPCM (pixels per centimeter) so to get PPI (pixels per inch) you need to add -units PixelsPerInch to your command (e.g. you could also use the fx operator t...
How to get the DPI of an image file (PNG)
1,404,054,539,000
I am using Trisquel 7.0 with Nautilus 3.10.1 installed. Whenever I display properties of a file, I've one file-specific tab like: Image,Audio/Video,Document etc. which displays special information about it. Example for a Image: Example for a PDF Document: How does Nautilus get this type of file-specific information?...
For the first level of information in the command line, you can use file. $ file gtu.pdf gtu.pdf: PDF document, version 1.4 For most formats, and more detailed information, you can also use Exiftool: NAME exiftool - Read and write meta information in files SYNOPSIS exiftool [OPTIONS] [-TAG...] [--TAG....
How to print Metadata of a file with the help of command-line?
1,404,054,539,000
I have an Asustor NAS that runs on Linux; I don't know what distro they use. I'm able to log in it using SSH and use all Shell commands. Internal Volume uses ext2, and external USB HDs use NTFS. When I try to use cp command to copy any file around, that file's date metadata is changed to current datetime. In example, ...
If you use man cp to read the manual page for the copy command you'll find the -p and --preserve flags. -p same as --preserve=mode,ownership,timestamps and --preserve[=ATTR_LIST] preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all W...
cp losing file's metadata
1,404,054,539,000
In a shell, how to automatically set the modification (or creation) date and time of a Quicktime video file based on the metadata in the file with a single command (or a single command line)? For JPG files, we have exiv2 -T, but is there a similar command for .mov files? To give an example, let's start with a file vi...
exiftool can set most of files metadata in addition to retrieving it, so it should just be a matter of: TZ=UTC0 exiftool '-FileModifyDate<MediaModifyDate' ./*.mov Or: exiftool -api QuickTimeUTC '-FileModifyDate<MediaModifyDate' ./*.mov Or recursively (also updating files in subdirectories): exiftool -api QuickTimeUT...
How to automatically set the modification (or creation) time of a Quicktime video file based on its meta data?
1,404,054,539,000
when opening a particular pdf file, evince decides to open it in "presentation mode". I see in the man page that evince has -s option to open in presentation mode, but I did not invoke it. I am simply opening all pdfs as evince file.pdf Somehow evince has decided on its own, to open this particular kind of pdf in pres...
Somehow evince has decided on its own, to open this particular kind of pdf in this idiotic mode. The "decision" is due to a PDF feature: /PageMode /FullScreen You may wish to permanently disable it in the PDF itself by replacing it with /PageMode /UseNone ... filling with 3 spaces at the end to keep filesize. Note...
evince opens pdf in "presentation mode"
1,404,054,539,000
I'm using RHEL7 on my Server, and I have a directory containing thousands of myriads of mixed .mp3 files and I need a script helping me to clean up that chaos. Let’s pretend 10 of my songs are for Miley Cyrus, 10 are for Ed Sheeran, 10 for Beethoven, 10 for Mozart and etc. All mp3 files are holding a numeric file n...
With exiftool: exiftool '-Directory<Artist' ./*.mp3 Recursively: exiftool -ext mp3 '-Directory<$Directory/$Artist' -r .
Shell Script reading metadata of a file and then mv each to a new directory
1,404,054,539,000
Linux already stores a lot of metadata with files. e.g. owner, permissions, file's name, checksums (in some file systems), along with essential data like location on disk. Is there any filesystem (e.g. btrfs, zfs, ext*) which allows you to store extra metadata?
Yes, most of the modern ones support extended attributes that can be used to store custom metadata: EXT4, Btrfs, ReiserFS, JFS, and ZFS. Check this question: What does mounting a filesystem with user_xattr do? and this page. If you meant fork (it is like a companion file, that's kept together with the main one inside ...
Filesystems which allow storing custom metadata on files?
1,404,054,539,000
I am trying to understand file/dir permissions in Linux. A user can list the files in a directory using cd test ls -l Even if the user issuing above commands does not have read, write or execute permission on any of the files inside the test directory, still he can list them because he/she has read permissions on ...
When you change a file's metadata (permissions, ownership, timestamps, …), you aren't changing the directory, you're changing the file's inode. This requires the x permission on the directory (to access the file), and ownership of the file (only the user who owns the file can change its permissions). I think this is i...
Why does chmod succeed on a file when the user does not have write permission on parent directory?
1,404,054,539,000
Is there are way to use utility like diff to find the difference in metadata of two identical file hierarchies? If I have two identical file structures like root_folder/ file1 file2 folder1/ file3 The diff utility will usually exit as though they are identical but adding them to tarballs will prod...
I highly recommend diffoscope in this sort of situation. You can run it before creating the tarballs, as diffoscope dir1 dir2 to find the differences between the two directories (including metadata), or after creating them, as diffoscope tarball1.tar tarball2.tar to find the differences between the two tarballs.
Diffing for metadata differences
1,404,054,539,000
I was monitoring a directory containing downloads from Google Chrome with ls -la and got this in the output: -????????? ? ? ? ? ? 'Unconfirmed 784300.crdownload' I've never seen such question marks in the output. There were other files in the directory with normal metadata output. When I ra...
That's a (temporary?) file which had disappeared in the time between ls reading its directory entry and trying to get the metadata from its inode. You can reproduce that by stopping ls just before it calls lstat on a file, removing that file, and then letting it continue: $ mkdir dir; touch dir/file $ gdb -q ls Readin...
Question marks in ls metadata output?
1,404,054,539,000
On a Linux system, I have a bunch of MP4 files named like 20190228_155905.mp4 but with no metadata. I've previously had a similar problem with some jpg's which I solved manually with exiv2 -M"set Exif.Photo.DateTimeOriginal 2018:09:18 20:11:04" 20180918_201104.jpg but as far as I can see, the DateTimeOriginal is only...
This uses ffmpeg (sudo apt install ffmpeg to install) and works on your exact file names. It replaces your old files with new ones with the metadata set. Maybe try WITHOUT the && mv "~$f" "$f" part first: $ for f in *.mp4; do ffmpeg -i "$f" -metadata creation_time="${f:0:4}-${f:4:2}-${f:6:2} ${f:9:2}:${f:11:2}:${f:13:...
Batch set MP4 create date metadata from filename
1,404,054,539,000
I have a drone that I used to make a flight movie, and I am going to use this footage to build a DEM (digital elevation model) of the topography I was filming. I can extract frames from the movie easily enough, but the method (ffmpeg) does not give these frames the lat-lon-elev-etc information necessary to reliably bu...
If you have the same number of photos as there are lines in the CSV file, then you can use a simple for loop: for photo in *.png; do IFS=" " read -r latitude longitude altitude time compHeading gimbHeading gimbPitch exiftool -GPSLongitude="$longitude" -GPSLatitude="$latitude" "$photo" done < test2.csv
Shell script to add different GPS data to series of photos
1,404,054,539,000
I know how to change a tag value, and how to extract tag values of a file from its metadata, and yes we have great tools like id3tag, exiftool, ffmpeg and etc. But I need to add a completely new tag, not change an existing one. For example, consider a situation that we have a .mp3 file and it has 4 tags for its metada...
TL;DR You cannot define your own ID3Tags, you must us the ones defined in the spec. Since a tag for Audio Bitrate is not defined, you're out of luck. That is not a problem with other audio containers (ones which use a different tag/comment system). Your major problem is that ID3 tags are a fixed specification. The ...
Add a new custom metadata tag
1,404,054,539,000
I have had this problem for a very long time, had several discussions with friends, and tried searching relating info online. All efforts were in vain so I decide to give a shot here. I have lots of files that I would like to annotate. Not necessarily are they pictures or documents, but also audio/video files. Now, I ...
Based on your question, it would be something like https://github.com/ljmdullaart/a-notate. Yes, it is written (by me) after you asked this question, and it is inspired on your question.
Annotating any files
1,404,054,539,000
We need to backup the a/c/mtime-stamps of files and directories, and have the ability to restore them if necessary. An example command to back up could be: $ timestamp backup --all-stamps --incl-dir-stamps --recursive out.stampbak file.bin /dir/with/files/ And to restore could be: $ timestamp restore --all-stamps out...
If you have GNU find and Perl available, you could rig something up with them. The -printf action to find can print the timestamps, and Perl has the utime function to modify them. Or two, the builtin one, and one in the Time::HiRes module, the latter supports subsecond precision. Some files for testing: $ find . -prin...
Backup and restore timestamps of files/directories?
1,404,054,539,000
I have a recovered dir with mp3 and flac files. The names were lost. So all I got is a mess of around 30,000 files iwth names like f30818304.flac I played some and see that the tags in the files are intact. But the thing is, most of it I probably don't need. I just want to see if there's any rarities in those files. ...
With eyeD3 (source): sudo apt install eyed3 find /usr/audio/incoming -name '*.mp3' -exec eyeD3 -t 'New Title' '{}' \; -exec mv '{}' /usr/audio/complete \; -t STRING, --title=STRING Set the track title. Or for one folder just eyeD3 --rename '$artist - $album - $track:num - $title' *.mp3
How do I get song names and artists from mp3 files in a dir?
1,404,054,539,000
I have a dual booted system, and its been years since I have used the linux side. I am running Fedora15 and am trying to upgrade. I have tried yum install preupgrade and I get the error message Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again I have...
EOL of Fedora 15 was 4 years before - on 2012-06-26 - so you are trying to update non-supported system. There are no updates nor security fixes. I'm afraid, that you are not able to upgrade your system to newest stable Fedora (24) easily and the best solution is to backup all and download and install stable system fro...
Fedora 15 updates
1,404,054,539,000
A lot of players can get CDDB info about Audio CDs, but I have never seen that in Clementine. Given the prestige and other qualities of this player It's hard to believe that it lacks this feature. Is it?
Based on perusal of the issues on Clementine's GitHub page, it looks like Clementine should have CDDB support, per Issue#1239 (which is marked as a duplicate of Issue#314). The closing comments of Issue #314 indicate that Clementine uses the libtunepimp library for talking to the MusicBrainz service for this tagging c...
Can Clementine music player fetch CDDB/FreeDB data?
1,404,054,539,000
I want to search for PNG's in a (sub-)folder structure with the meta tag software set to the value GNOME::ThumbnailFactory and delete them with a single bash command. Have the story behind it, you can skip that if you want: I scrapped my Ubuntu ext filesystem by formatting the drive, and then decided to save my file...
You can do this using ImageMagick. Once ImageMagick is installed, use command identify -verbose image.jpg and pick what you want from the output using grep find / -name "*.png" -exec sh -c ' if identify -verbose "${file}" | grep your_pattern_here then echo "${file}" # or do something else here, e.g. rm fi ' ...
Searching Files according to PNG Meta-Tags
1,404,054,539,000
I have been using unix systems the majority of my life. I often find myself teaching others about them. I get a lot of questions like "what is the /etc folder for?" from students, and sometimes I have the same questions myself. I know that all of the information is available with a simple google search, but I was wond...
tree --info will do what you want. You can create .info txt-Files that contain your remarks about certain files and folders or groups of files and folders (using wildcards). tree --info will then show them in the directory listing. Multi-line comments are possible. There is also a Global info file in /usr/share/finf...
Is there a way to add a "description" field / meta-data that could viewed in ls output (or an alternative to ls)?
1,404,054,539,000
Today I noticed that tripwire thinks that some Apache configuration files changed yesterday. I know I did not make any changes to those files. Looking at the info, it shows that only the Inode number changed: Property: Expected Observed ------------- ----------- ...
One way: cp -p file file.new && mv file.new file For example: $ ls -li file 12289 -rw-r--r-- 1 jeff jeff 0 Jun 13 14:24 file $ cp -p file file.new && mv file.new file $ ls -li file 12292 -rw-r--r-- 1 jeff jeff 0 Jun 13 14:24 file Another possibility would be that the file was restored from a backup system (and...
Why does a file's Inode number change and nothing else?
1,404,054,539,000
Does anyone know when Unix supports birth/creation time stamps for files and directories? If possible also when first file manager (GUI) displays it by default for users. For comparison with Windows, Unix like and Linux: I know from practical experience that since Windows XP (year 2001) in Windows File Manager (GUI) d...
Full support for birth timestamps has three components: the file system must be able to store them; the operating system must provide access to them; end-user software must display them. In the Unix world, it seems that at least three POSIX-style file systems support birth timestamps: UFS2, the default in FreeBSD s...
Since when do Unix systems support birth/creation time (btime/crtime) for files and directories?