File name is a name used to identify a file uniquely on given file system.

learn more… | top users | synonyms

1
vote
0answers
96 views

How to use fslint (in particular findnl) on the command line to actually mimic the behavior of the fslint-gui?

So I am trying the fslint tools. However, the help included in those tools as well as the man page don't indicate that the cleanup actions offered by the fslint-gui are also available through fslint ...
2
votes
2answers
180 views

grep and directories containing spaces

I would like to search all files containing an association of strings (here the files should contain 'arthur' AND ('déni' OR 'deni') for instance) in a directory and subdirectories. After some search ...
1
vote
1answer
130 views

cp /etc/DIR_COLORS ~/.dir_colors not responding

I'm using CentOS 6.5 and Putty. My problem is that directory file names are shown in dark blue color which is hard to read. I google searched and found this link; basically it's copying the DIR_COLORS ...
1
vote
1answer
75 views

Command works with tilde at the end. How?

I'm on Ubuntu. I have a script called myscripts in /usr/bin/myscripts This script simply changes the current directory to ~/Work/MyScripts Normally, I simply open a terminal and type ~/Desktop$ . ...
3
votes
3answers
4k views

Why can't find -regex match a newline?

Why does this fail? touch "$(printf "a\nb")"; find . -regex './.\n.' I also tried these, none of which work: find . -regextype posix-extended -regex '.\n.' find . -regextype posix-awk -regex ...
3
votes
4answers
315 views

Use basename to parse a list of paths held in a file

I'm running Mac OSX and trying to use the command line to find the number of files I have with the same name. I tried to use the following command: find ~ -type f -name "*" -print | basename | sort ...
2
votes
1answer
385 views

Find out if files in a folder exist under other name in other folder

Possibly a little incorrect English ahead: There are at least 2 folders. For this, A contains files without extension, usually usernames, and B contains similar files, with '.yml' extension or ...
1
vote
7answers
210 views

what are some uses of .(single period) & ..(double period) in the shell command line

The single period . means current working directory The double period .. means parent of the current working directory I can only think of . being used in relative pathname etc cd ./bin/usr How are ...
3
votes
4answers
230 views

How to sort a list of files by time, given only the filenames

Given a list of file names, how can I sort it by file modification time? The resulting output needs to look exactly like the input with the exception that the data has been sorted accordingly. Here ...
3
votes
1answer
90 views

Make Linux forbid colons in file names on NTFS partitions

Does Linux really allow colons in file names, even on NTFS partitions? Why is that? And is there any option to set it straight, and do not allow colons (and other characters restricted by Windows) in ...
1
vote
3answers
62 views

Append to the name of each file in directory [duplicate]

How to append “.backup” to the name of each file in your current directory?
0
votes
2answers
105 views

Handling files with whitespace in their names

I have a lot of files that I need to sift through, specifically grep for certain keywords IN THE FILE, not he FILENAME. I have some 300+ files on a filesystem (so the files are within multiple ...
1
vote
2answers
225 views

How to batch clean filenames containing invalid characters

I have a larger directory with files whose filenames contain special characters such as line breaks. The origin of these characters is seemingly that I copied and pasted text from within pdf files ...
8
votes
1answer
236 views

Can I truncate long file names in ls listing

I have a number of files with very long names. Please, is there a way to use ls -C and truncate the file names to get more columns for an overall view? Or is there a better way to get a compact ...
2
votes
2answers
361 views

Extracting parts of filename

I'm trying to use a part of the file name to be inserted into a new file created using the script. For eg: dcn_2014_01_31_14_17_45_505.pcap and dcn_2014_01_31_14_32_27_656.pcap should give ...
2
votes
2answers
322 views

How do I check that a filename conforms to a pattern?

I'm tasked with writing a shell script which checks that a filename conforms to a specific pattern and I'm not sure how to go about it. The filename should follow a pattern which looks like: ...
11
votes
2answers
2k views

What is the difference between “du -sh *” and “du -sh ./*”?

The title says it all. What's the difference between those 2 commands? NOTE: I'm more interested in the * and ./* part.
1
vote
2answers
98 views

Keeping the latest two version and delete the remaining

I have a list of files (say xsl format below) in one directory. I want to keep the last two version of all files. (I can delete the remaing files) {A}_1.0.xsl {A}_2.0.xsl {A}_3.0.xsl {A}_4.1.xsl ...
9
votes
3answers
2k views

identify files with non-ASCII or non-printable characters in file name

In a directory size 80GB with approx 700,000 files, there are some file names with non-English characters in the file name. Other than trawling through the file list laboriously is there: An easy ...
0
votes
1answer
50 views

Files with “core” name

Can I be sure that files with name core on the system are core dump files? Or how can I be certain about some files that they are core dumps to delete them? (best practices are welcome)
12
votes
2answers
502 views

Shell filename pattern that expands to dot files but not to `..`?

Recently I had a little mishap caused by a shell pattern that expanded in an unexpected way. I wanted to change the owner of a bunch of dot files in the /root directory, so I did chown -R root .* ...
5
votes
2answers
371 views

How does GLOBIGNORE work?

According to bash's manual page: GLOBIGNORE A colon-separated list of patterns defining the set of filenames to be ignored by pathname expansion. If a filename matched by a ...
0
votes
3answers
430 views

Identify if files or directories are hidden

I am trying to write a bash script that prints out all files (including hidden) in a directory recursively and records the number of files, hidden files, hidden directories and directories. This is ...
8
votes
3answers
123 views

POSIX compliant way to work with a list of filenames possibly with whitespace

I have seen Bash scripting guides suggesting the use of array for working with filenames containing whitespace. DashAsBinSh however suggests that arrays are not portable so I am looking for a POSIX ...
6
votes
3answers
144 views

How can I determine a file's conventional filename extension

The file command is good at determining file types for my needs. Is there any way to map those results to conventional filename extensions?
2
votes
1answer
316 views

Mouse shortcut to copy the path to a file in the Gnome file manager

Is there a Linux equivalent of the Windows Shift+Right-click sequence? I use this a lot on files and directories to get the 'hidden' "Copy as path" option in the pop-up menu. It saves a lot of ...
0
votes
0answers
97 views

Shell Script : Check for all the source files in different paths

This is the naming convention of the file. <yearmonthdate>_<sourcesystem>_<totalnoofpartsof file>_<subject area>_<part number>.dat (or .dat.gz) First part is Date, ...
3
votes
6answers
340 views

How to delete a NTFS filesystem file whose name contains “:”?

I backup some of my Linux files in a NTFS removable hard disk several days ago, this time I need to remove those files. But I find it difficult since: On windows, it complains that "Could not find ...
0
votes
1answer
219 views

Rename multiple files removing last characters and renumbering

I have a photo directory with hundreds of files named in the format: 2013-08-02 19.21.27.jpg I wish to keep the first 10 characters (date) and append "-001", etc. being consecutive for each date. ...
2
votes
2answers
68 views

Proper escape sequence for a non-standard file name [duplicate]

I'm trying to remove a file I made by mistake using --exclude with tar. I ended up making a tar file named --exclude=*.tar Now I want to delete it but I'd like to rename it first. How do I escape it ...
3
votes
1answer
154 views

How can there be a directory named `~`?

I was trying to test out this buggy/new tool to see how it works, and it prompted me to choose a directory to use for stuff I am doing. From the directory ~/Code/indep, I typed in ...
5
votes
1answer
250 views

Variable in sed

I have a file that contains filenames with absolute path. In the middle of that path, is a variable directory, whenever I hard code the variable part, it works fine, but when I replace it with the ...
2
votes
1answer
16 views

zsh: how to get file expansion working in print statement

I have the following code which prints recursively all files inside /usr/local/include: % files=(/usr/local/include/**/*(^/)) % print -l $files Is it possible to get rid of the temporary variable? ...
3
votes
4answers
407 views

How to prepare files for rsync on a case insensitive filesystem?

I am transferring a large number of files on a HFS+ filesystem. The files are currently on ext2 partitions. I have conflicts due to case insensitivity of the target partition (HFS+). I want to ...
1
vote
1answer
297 views

rename multiple files recursively and remove multiple characters such as ? : or newline from names

I have seen a few similar questions, but nothing that shows how to remove any of a set of special characters from all file names recursively. I want to keep uppercase and lowercase letters, numbers ...
0
votes
2answers
234 views

Making md5sum understand file names with spaces

I need to use md5sum in Python by using pipe to calculate checksum for a bunch of .mp3 files... is there a command which ignore whitespaces in filenames on the command line of md5sum program? For ...
3
votes
1answer
93 views

Test for link with trailing slash?

I created in /tmp/test/ mkdir somedir ln -s somedir/ somelink I want to loop through only directories: for file in */ ; do if [[ -d "$file" && ! -L "$file" ]]; then echo "$file is a ...
2
votes
1answer
193 views

Merging folders with practically the same name but different casing

When digging around in the advanced settings in Dropbox I lost a folder. I only discovered this about a month later. I managed to get this folder back from Dropbox however the file structure of the ...
22
votes
3answers
590 views

shellcheck is advising not to use basename: why?

I am trying out shellcheck. I have something like that basename "${OPENSSL}" and I get the following suggestion Use parameter expansion instead, such as ${var##*/}. From the practical point of ...
1
vote
3answers
145 views

splitting the string in bash script

I am new to bash script. I am taking some input from user and checking details about that. Example: $HOME/Documents/test/one.txt I take the above string as an input and want to retrieve one.txt, I ...
1
vote
3answers
496 views

fsck -cc /dev/sdb1 gives this result. Is everything okay?

root@host [/]# fsck -cc /dev/sdb1 fsck from util-linux-ng 2.17.2 e2fsck 1.41.12 (17-May-2010) Checking for bad blocks (non-destructive read-write test) Testing with random pattern: done /dev/sdb1: ...
7
votes
1answer
209 views

Why do *nix filesystems support file names with newlines? [duplicate]

According to this page: File names in Linux can contain any characters other than (1) a forward slash ( / ), which is reserved for use as the name of the root directory (i.e., the directory that ...
2
votes
1answer
86 views

Symlink with @ symbol?

I found that there is a symlink generated by ruby which has a @ sign at the path: default -> /Users/MyUserName/.rvm/rubies/ruby-2.0.0-p247@gemset The folder ...
0
votes
1answer
2k views

Why does scp say “No such file”?

I have a bash script that uses scp to copy a file from my machine to another. The script keeps on exiting after I enter the SSH password with the error: <filename>: No such file or directory ...
1
vote
5answers
2k views

Find files by the length of filename

I want to find all files by length of the file names. For example if I want to find files of length 1, such as a.go, b.go I put: grep '.\{1\}' file But this does not work. What command can I use ...
1
vote
2answers
450 views

Way to write new filename on wildcard input?

I have some experience with Inix terminals from science internships I've been part of, mainly using a few utilities like grep, awk, and sed but there is one thing I've been trying to figure out for a ...
3
votes
3answers
325 views

Command for taking a screenshot to a new file

I want to configure a global hotkey to take a new screenshot and save it, say, somewhere inside my home folder. I can take a screenshot with ImageMagick with this command: import screenshot.jpg ...
1
vote
4answers
503 views

Write output of wget or curl to a custom filename based on the url

For example I have a link http://www.abc.com/123/def/ghi/jkl.mno. I want to download it using wget or curl and get the name of output file as def_ghi_jkl.mno, where the part def_ghi is taken from the ...
7
votes
3answers
358 views

Select unicode filename in Bash

Ok; suppose I'm in Bash and I have several files in a folder. Several of them are named file☠☡☢☣.txt, where ☠☡☢☣ starts with crazy untypable unicode characters. How would I refer to one of them? ...
3
votes
2answers
58 views

Is there a way to condense ../.. parts of a path out programatically?

Say for example I have these types of paths to files in a script: /path/to/some/file/../../file1.txt Is there a command I can call such as readlink that will convert this path to its actual ...