Questions tagged [filenames]
File name is a name used to identify a file uniquely on given file system.
1,073
questions
57
votes
3answers
18k views
unix, difference between path starting with '/' and '//' [duplicate]
In unix/linux, any number of consecutive forwardslashes in a path is generally equivalent to a single forwardslash. eg.
$ cd /home/shum
$ pwd
/home/shum
$ cd /home//shum
$ pwd
/home/shum
$ cd /home///...
8
votes
3answers
19k views
How to add unique id to file name in cron job?
My cronjob looks like this:
5 3 * * * mysqldump -u root test > /srv/backup/mysql_daily.dump
How can I make filename unique for every time when cronjob writes mysql_daily.dump?
31
votes
1answer
11k views
rsync: colon in file names
Other than by renaming the files first, how can I rsync files that may have colons in their names?
4
votes
3answers
458 views
Open files in emacs by filename instead of complete path
Assume I have a bunch of directories and can guarantee that no two directories have a common filename (i.e. if foo/bar exists, then bar doesn't exist in any of the other directories). How can I setup ...
4
votes
2answers
956 views
Is there a user interface in Emacs allowing one to “grab” the buffer's filename conveniently?
It happens quite often that I want to use the path of the file opened in a certain buffer in Emacs (either the full path or the basename) in another place (a buffer or a different X program, say, a ...
180
votes
10answers
236k views
Looping through files with spaces in the names? [duplicate]
I wrote the following script to diff the outputs of two directores with all the same files in them as such:
#!/bin/bash
for file in `find . -name "*.csv"`
do
echo "file = $file";
diff $...
71
votes
14answers
69k views
Unix file naming convention [closed]
I was wondering what is the naming convention for files in Unix? I am not sure about this, but I think there is perhaps a universal naming convention that one should follow?
For example, I want to ...
6
votes
3answers
699 views
How do I delete a file named “°” in bash
I've accidentally created a file named °. Now I'm having trouble deleting it with bash.
[/opt/etc/sudoers.d] # ls -l
-r--r----- 1 admin administ 21 Feb 3 23:54 010-root
-rw-r--r-- 1 ...
11
votes
1answer
3k views
What does 'uni' mean in unistd.h
What does uni mean in unistd.h
Does it mean unix? or universal?
What is it?
7
votes
1answer
1k views
Why do some symbolic links affect program behavior?
One thing that has been puzzling me for some time is this:
% which halt
/sbin/halt
% file /sbin/halt
/sbin/halt: symbolic link to `reboot'
However, executing sudo halt does, of course, not reboot ...
15
votes
1answer
8k views
What does *~ mean?
At the end of a makefile I saw
rm -f *~ *.class
I understand the *.class, but what's *~?
1
vote
3answers
6k views
How can I randomize file names in a given directory?
Ok, this may sound like an odd request but it really has a good purpose! I have a Panasonic Plasma TV with an SD card slot, via which I can display a slideshow of JPEG photos. This is useful for ...
21
votes
4answers
13k views
bulk rename (or correctly display) files with special characters
I have a bunch of directories and subdirectories that contain files with special characters, like this file:
robbie@phil:~$ ls test�sktest.txt
test?sktest.txt
Find reveals an escape sequence:
...
44
votes
3answers
18k views
How to find out which (not installed) Debian package a file belongs to?
On Debian systems (and derivatives):
$ dpkg --search /bin/ls
coreutils: /bin/ls
That is, the file /bin/ls belongs to the Debian package named coreutils.
But this only works if the package is ...
72
votes
1answer
87k views
Which Fedora package does a specific file belong to?
In the Debian family of OSes, dpkg --search /bin/ls gives:
coreutils: /bin/ls
That is, the file /bin/ls belongs to the Debian package named coreutils. (see this post if you are interested in a ...
8
votes
1answer
4k views
Recursively compare directory contents by name, ignoring file extensions
I have a directory containing about 7,000 music files. I used lame to recursively re-encode all files in it to a separate directory, outputting all files with the same relative path and file name. ...
8
votes
3answers
989 views
Why do tar and gzip files usually have a file extension?
File extensions are not necessary on unices, still every tarred, gzipped or bzipped file I encounter has a file extension like .tar, .tar.gz or .tgz.
Is there any special reason for that or is that ...
1
vote
1answer
391 views
How can I grep through files whose name begins with `-`? [duplicate]
I've tried this.
grep -r thanks * slave-iv
grep: invalid option -- '@'
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
Here's ...
52
votes
3answers
45k views
What charset encoding is used for filenames and paths on Linux?
Does it depend on what file system I use? For example, ext2/ext3/ext4 but also what happens when I insert one of those "joliet" CD-ROMs with ISO 9660? I've heard that POSIX contains some sort of spec ...
125
votes
6answers
24k views
How does Linux handle multiple consecutive path separators (/home////username///file)?
I'm working on a python script that passes file locations to an scp subprocess. That's all fine, but I'm in a situation where I may end up concatenating a path with a filename such that there's a ...
42
votes
8answers
66k views
Grabbing the extension in a file name
How do I get the file extension from bash? Here's what I tried:
filename=`basename $filepath`
fileext=${filename##*.}
By doing that I can get extension of bz2 from the path /dir/subdir/file.bz2, but ...
14
votes
2answers
5k views
the slash (/) after a directory name on shell commands
I have a little question here.
If I have two files, say filea and fileb, mv filea fileb would
delete fileb
rename filea to fileb
Then if I have two directories, say dira and dirb, mv dira dirb ...
21
votes
6answers
3k views
Is there a terminal app that allows filenames to be clickable?
Is there a terminal emulator (extension or app) that does link resolution for local paths?
In particular when I see things like:
/home/sam/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/...