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

learn more… | top users | synonyms

1
vote
2answers
47 views

How to extract first part of filenames with same suffix?

I want to get at the prefix of a variable-length filename. In: some_filename_123-uniq.tar.gz Out: some_filename_123 In: some_filename_1-uniq.tar.gz Out: some_filename_1 This does the exact opposite ...
1
vote
1answer
63 views

Create file for every result of find command?

With this line of code I generate an output of every result. exec("find ics/ -mmin +3 -type f -name '*.pdx' -exec basename {} ';' > ./tmp/filename") How can I generate a file with dynamic file ...
5
votes
2answers
446 views

How do you call the “happy-dog” part of file “happy-dog.png”?

I just realized I don't know how file is called in file.ext. The whole file.ext is called a file or filename, ext is called extension but how do you call the file part itself of file.ext? For ...
0
votes
1answer
48 views

quoting problem when piping find output into xargs [duplicate]

I have a directory with the following subdirectories, i.e. If I run $ tree -L 1 . ├── 2007-06-20_to_2008-10-01 ├── 2008-07-21_to_2008_08_12-Nokia 2mp ├── 2009-11-01_to_2011-01-10 - All iphone Pics ...
2
votes
0answers
103 views

some cyrillic file names got broken after moving from server to server

I moved my website from one server to another and encounter a problem with cyrillic filenames. Some cyrillic URLs in wordpress are fine and some are now broken. It used to be OK on previous server. ...
2
votes
1answer
116 views

Creating a symlink with a colon in the name on cygwin bash

I'm using bash, version 4.3.42(4)-release (i686-pc-cygwin) on cygwin. I want to create a symlink C: -> /cygdrive because a vagrant build process has that file path specified. The vagrant script has ...
1
vote
1answer
90 views

Extracting filename from path string

I have requirement to extract the filename from a given path for e.g. /dev/user/test.csv. I need location /dev/user/ in separate variable and file name test.csv in different variable. Could someone ...
1
vote
5answers
60 views

can't remove file with carriage returns

I have a file blahblah\r\n.txt that I want to remove but rm blahblah\r\n.txt does not work as I receive No such file or directory message. How to remove??
19
votes
7answers
3k views

Is it considered a best practice to not use capital letters in file naming?

People say you shouldn't use spaces in Unix file naming. Are there good reasons to not use capital letters in file names (i.e., File_Name.txt vs. file_name.txt)? Or is this just a matter of personal ...
0
votes
2answers
40 views

Does soft linking a directory hard link its subfiles?

Suppose I have the following configuration: Folder A file1 file2 I then create a soft link of Folder A as follows: ln -s A B so that we now have: Folder A file1 file2 Folder B ( symlink of ...
2
votes
1answer
22 views

How can I delete a former MTP directory, which now gives me input/output error whenever I try?

I have ~/srv/mtp, which I do not remember how I created. It was back when I was trying to set up a MTP mountpoint using various tools for that. Currently I can't do anything to the directory. ○ file ...
2
votes
3answers
161 views

How to search for text within compressed files and get just the files name

I'm trying to find just the files' names which contain an specific string. The files are compressed (.gz). I don't have zgrep installed and can't install it. Therefore I can't use the -l option. ...
7
votes
2answers
779 views

Is it possible to fake a specific path for a process?

I'm trying to run ADB on a linux server with multiple users where I am not root (to play with my android emulator). The adb daemon writes its logs to the file /tmp/adb.log which unfortunately seems to ...
1
vote
1answer
28 views

Scan though directory of files and find replicates with same name and concatenate them into one file

I have a directory with a bunch of files For example: ExperimentA_Rep1.bed ExperimentA_Rep2.bed ExperimentA_Rep3.bed ExperimentB_Rep1.bed ExperimentD_Rep1.bed ExperimentC_Rep1.bed ...
3
votes
3answers
118 views

Why are square brackets preventing shell expansion?

'4800483343' is a directory, and 'file1' & 'file2' are two files in it. Why is the following happening? $ ls 4800483343 file1 file2 $ md5sum 4800483343/* 36468e77d55ee160477dc9772a99be4b ...
5
votes
4answers
292 views

How to find missing files with sequential names? [duplicate]

I have thousands of files named 1.txt 2.txt and so on. Some of those files are missing. Which would be the easiest way to find out which files are missing?
3
votes
3answers
125 views

Using basename to strip file extension and search for files with the same name

Basically, I have a folder /test/ that has a number of files of type .doc and .pdf. Some of the files have a .pdf and a .doc version, such as test.doc and test.pdf while others only have one version. ...
0
votes
1answer
157 views

SED find and replace element in filename with incremental values

A sample filename is Sample-0.0.1-SNAPSHOT.jar (result of a maven build in jenkins). My goal is to run a shell script that executes on failure and what that script does it adds incremental numbers to ...
3
votes
2answers
109 views

How can I remove files which contain special characters and Latin-1 characters?

I have 2 files in a directory named App on my Ubuntu mahcine. I want to remove those 2 files completely from that directory, but when I try to remove them using rm -rf, they are not deleted. I can't ...
2
votes
1answer
151 views

Using rename command to rename first part of a file

I have three files in a directory (in mac-osx terminal) say INIT_Struc1 INIT_Struc2 INIT_Struc3 which I need to rename as FINAL_Struc1 FINAL_Struc2 FINAL_Struc3 When I use the rename command ...
2
votes
2answers
99 views

Remove specific (known) extension from filename if it's there

I'm not even sure whether grep is meant to be used for regex in one-line data. Googling led me to this lookahead expression that, along with grep, matches any .ext file and returns bare name: ...
3
votes
2answers
506 views

Regex file name with multiple digits

Say I have the following file: test_file-1234-master.tar.gz I have tried to un tar using the following commands tar -xf test_file-[0-9]+-master.tar.gz tar -xf test_file-[:digit]-master.tar.gz ...
3
votes
2answers
169 views

How are log files named?

Or what can we infer from the names of log files? For example, when I want to check the Xorg logs, I find three files: Xorg.0.log Xorg.0.log.old Xorg.1.log You can also find many such log ...
0
votes
1answer
30 views

Find filename using list inside a file

How can i find all filenames that match a string in a list inside a file? I have a list_file.txt with a list of email addresses each in a new line like this: 1@mail.com 2@mail.com 3@mail.com ... ...
0
votes
1answer
1k views

Using a relative path? I know the absolute path. Using copy command? [closed]

I have a lab I am doing for a Linux Operating class. The question I am stumped on is: For the following questions, only use the cp command to copy files. You should currently be inside your ...
2
votes
1answer
68 views

To which files does the key stroke and mouse click data go first and what form they have?

I want to know which files belong to keystrokes and mouse clicks, and what kind of data is sent to them. My main purpose of asking this question is key logging. I want to write a key logger script ...
1
vote
1answer
221 views

What characters are valid to use in filenames? [duplicate]

I seems like it is possible to create filenames in unix with just about any valid character. touch \; && touch \\ && touch \" && touch $'\n' && touch $'\t' && ...
3
votes
1answer
197 views

How does Linux detect mime type? [duplicate]

I have a PDF file with extension .pdf. If I remove .pdf - the file is still recognized as PDF file ($ file sample - output sample: PDF document, version 1.4.) What is the mechanism of filetype ...
0
votes
1answer
14 views

Obtain filepath of directories containing a particular filetype in alphabetical/numerical order [duplicate]

I have a directory that contains 800 subdirectories named disp-001 ... disp-800. All these sub-directories need to contain a specific file say stdout. One among them does not contain the file and I ...
5
votes
1answer
549 views

Untar filenames in a character encoding different from encoding used in the filesystem

I occasionally get tarballs where the filenames are encoded in ISO-8859-1 or some other pre-Unicode scheme. My system uses UTF-8, so when I untar these archives with the usual options (tar xvf ...
0
votes
2answers
80 views

File System that supports duplicate directory names

Is there a file system that supports duplicate directory names. Ideally to distinguish between directory names you would use indexes(file directory order). This is related.
5
votes
1answer
105 views

Using File Date/Time as Metadata: Reliable?

Background: I have groups of files in their own directory which I merge into one file in order of their filename. I call them t1.txt, t2.txt, t3.txt... I merge them in order of the integer. ...
0
votes
4answers
113 views

How can I test for the .RAW file extension?

I'm trying to set up an sh script that will run every 30 minutes. During each run, I want to check a directory for the presence of at least one .RAW file. Upon finding that file extension, I will have ...
0
votes
2answers
76 views

Putting a single quote in a filename [duplicate]

We can a make a directory named $"dollars"&<>\dogs if we surround it with single quotes like the following mkdir '$"dollars"&<>\dogs' However, what if I want to include a ...
4
votes
4answers
959 views

Null and escape characters

I know that a filename in Linux has no restriction whatsoever except for two characters '/' and '\0'. I know that '/' is prohibited because it is a directory separator but is there any other reason ? ...
0
votes
2answers
43 views

Why do compiled programs create a copy with ~?

Why is it that when I run programs for the first time it creates a copy of that file with a ~ at the end? For example, a file like HelloWorld.lua when run would create 2 files: HelloWorld.lua and ...
2
votes
2answers
114 views

What other special characters are there?

For filenames, I know that you have to use either a double quotes or a backslash to include a space in your file name. Like mkdir "I like coffee" is the same as mkdir I\ like\ coffee Now when you ...
2
votes
2answers
83 views

Why are certain naming conventions so inconsistent in Linux? [closed]

It seems like the general pool of logging, changelog, readme, and config files in Linux is very inconsistently named. It always makes me wonder, why didn't *nix devs decide on a common file name ...
35
votes
7answers
3k views

Is `~/Documents` a relative or an absolute path?

This is merely just a vocabulary question, but which keeps turning around in my head. It comes from a practice exam from a LPIC preparation book. The correct answer according to the book is that ...
-2
votes
1answer
114 views

how to delete swarm of ._ files using commandline

I have these files in MAC which have weird ._ character before filenames/folders. Which I want to delete in one shot. Is there a way to do it in commandline? eg. ._js ._css ._image if I go into ...
0
votes
1answer
213 views

usr/bin appears empty

I'm trying to make a program (Thunderbird) run at startup, but when I go to usr/bin it seems empty. However, if I run $ which Thunderbird in terminal, it tells me /usr/bin/thunderbird. The usr/bin ...
2
votes
2answers
169 views

List all files with the same name and number of that files

I wonder if there is an easy command to list all files with the same names and number of that files? I would like to do it recursively and I do not mean concrete filename. I can imagine the output ...
0
votes
3answers
170 views

What is the difference between a directory name that ends with a slash and one that does not? [duplicate]

Is there any difference between a directory name such as mydirectory and mydirectory/ I noticed this happens when I execute ls in some directories - some of the directory names have a slash and ...
1
vote
2answers
372 views

how to store output of a command into array with each value in a double quote

I want to store each output in double quoted array values. values can have space also. FOUNDFILES=($(locate --database ~/.locate.db -i -b "$INPUT")) if input to the locate command is very very ...
-2
votes
2answers
48 views

How to find only the name of a link? [closed]

Specifically, I need to write a C program where I put inside the pathname of a symbolic link and on output I print only the name of that symbolic link(not the name of the file pointed by the link). ...
1
vote
2answers
61 views

Script to compare the “file size” with “last name of file” and if unmatched delete the file

In my environment, we'll be receiving files from clients into our Sftp server. Sftp processes the files, and moves it to another tool, by appending the file size at the end of the file name. For ...
2
votes
2answers
115 views

print empty line in sed output when passing multiple filenames

I'm doing some placeholder replacements in various files that I'm feeding to ldapadd, to add new entries to an LDAP directory: sed \ -e 's/%%FOO%%/whatever/g' \ -e 's/%%BAR%%/other thing/g \ ...
4
votes
3answers
1k views

copy all files that have no extension

We can copy some file by extensions like this: cp *.txt ../new/ but how can I copy all files that have no extension?
0
votes
1answer
67 views

Binary not accesible from Bash despite being in path

I am learning how to program in Racket. It's binary is in "/Applications/Racket v6.2/bin/racket". Let me show what happens: MacBook:~ enedil$ echo $PATH /Applications/Racket\ ...
1
vote
1answer
63 views

Redirect a file descriptor before execution

I know that I can change the file a program writes to by interrupting the process in gdb, closing using the file descriptor and then re-opening with the file name I want. Is there a way to do the same ...