Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [dot-files]

A dotfile is a file or directory whose name begins with a dot. These files are typically found in user home directories, contain configuration information and hidden from view on Unix systems.

125
votes
10answers
125k views

How do you move all files (including hidden) from one directory to another?

How do I move all files in a directory (including the hidden ones) to another directory? For example, if I have a folder "Foo" with the files ".hidden" and "notHidden" inside, how do I move both ...
39
votes
8answers
7k views

Are there pitfalls to putting $HOME in git instead of symlinking dotfiles?

I have for many years had my entire $HOME directory checked into subversion. This has included all my dotfiles and application profiles, many scripts, tools and hacks, my preferred basic home ...
35
votes
3answers
6k views

Why do some applications use ~/.config/appname for their config data while others use ~/.appname?

I've noticed that some applications put their configuration files to ~/.config/appname while others use ~/.appname (the classic way, AFAIK) for this. What's the sense in this distinction and what ...
31
votes
3answers
11k views

How can I stop seeing hidden files in the Midnight Commander?

The Midnight Commander is a very helpful tool when we're using only the text mode. But sometimes it bothers me that I have to see all the hidden files inside a folder (files that begin with "."). I'...
26
votes
3answers
7k views

How to rename file to .. (dot dot)?

Apparently you can rename file to .... If I were insane, how would I rename file to .. or .? Is such a filename even allowed? Backslash doesn't seem to disable dot's special meaning: $ mv test \. ...
23
votes
5answers
21k views

What's so special about directories whose names begin with a dot?

I was wondering what the difference between these two were: ~/somedirectory/file.txt and ~/.somedirectory/file.txt It's really difficult to ask this on Google since I didn't know how to explain ...
22
votes
7answers
1k views

`command .*` acts on the parent directory [duplicate]

Someone of our team wanted to recursively change the user permissions on all hidden directories in a users home directory. To do so he executed the following command: cd /home/username chown -R ...
21
votes
2answers
2k views

How to keep dotfiles system-agnostic?

Due to work I have recently started using OS X and have set it up using homebrew in order to get a similar experience as with Linux. However, there are quite a few differences in their settings. Some ...
20
votes
5answers
14k views

How to match * with hidden files inside a directory

How to match the hidden files inside the given directories for example If I give the below command it's not giving the result of the hidden files, du -b maybehere*/* how to achieve this ...
15
votes
3answers
14k views

Why are filenames that start with a dot hidden? Can I hide files without using a dot as their first character?

Initially I thought it was a coincidence, but now I see there's even a tag for it: all hidden file names start with a dot. Is this a convention? Why was it chosen? Can it be changed? Or in other words ...
15
votes
3answers
3k views

Clean $HOME directory

During a few years, in my $HOME directory a lot of hidden files and directories appeared. I would like to continually delete the unneeded ones. How can I find out which applications created those ...
14
votes
1answer
64k views

proper way to iterate through contents in a directory [duplicate]

I need to iterate through every file inside a directory. One common way I saw was using the for loop that begins with for file in *; do. However, I realized that it does not include hidden files (...
13
votes
2answers
2k 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 .* ...
12
votes
5answers
8k views

cp hidden files with glob patterns

Situation : $ mkdir foo && touch foo/.test $ cp foo/* . zsh: no matches found: foo/* (or bash : cp: cannot stat ‘foo/*’: No such file or directory) I have a directory full of hidden folders ...
12
votes
2answers
2k views

cp behaves weirdly when . (dot) or .. (dot dot) are the source directory

This answer reveals that one can copy all files - including hidden ones - from directory src into directory dest like so: mkdir dest cp -r src/. dest There is no explanation in the answer or its ...
12
votes
3answers
5k views

Why are some files and folders hidden?

I can understand the rationale of hiding files and folders in the /home/user directory to prevent users from messing around with things. However, I do not see how the same rationale can be applied to ...
11
votes
1answer
6k views

Where should user configuration files go? [duplicate]

If I look at my home directory there are a large number of dot files. If I am creating a new program that needs a user configuration file, is there any guidance where to put it? I could imagine ...
9
votes
8answers
12k views

display only files starting with . (hidden)

I tried to display only hidden files but don't know how to do it. That is working (but matching also dots in other places) ls -la | grep '\.' Was trying adding ^ but didn't find the solution.
8
votes
1answer
12k views

how to copy or backup files ignoring dot files

I want to back-up all files from my laptop partitions to external HDD. I ran, for example cp -a /med*/ravb*/*00 /med*/ravb*/M*L*/7.3GB_CP && echo "7.3GB BACKED UP PROPERLY" || echo "7.3GB ...
8
votes
1answer
25k views

How can I delete a hidden folder?

I want to delete many configuration folder in my home user folder but I can't figure out how to delete them. How can I delete a hidden folder?
8
votes
4answers
339 views

Is the behaviour of .* to include . and .. defined in LSB or POSIX or some other specification?

Is the behavior of .* to include . and .. defined in LSB or POSIX or some other specification?
7
votes
1answer
262 views

How are files/dirs hidden from ls -a while still being accessible otherwise in a POSIX compliant system?

For example, in ZFS under FreeBSD and ZoL, there is a magic .zfs dir inside of each zpool mountpoint and you can use zfs set snapdir=visible to make that .zfs dir visible. What makes me curious is: ...
6
votes
3answers
2k views

When you type “ls -a”, what is the significance of “.” and “..”?

Whenever you type ls -a into the command prompt, you usually get all of your folders, files, and then you see that the first two entries are . and .. Just curious, but what is the significance of ...
6
votes
6answers
3k views

How do I specify arguments to return all dot files, but not . and ..?

Normally dot files are not included for wildcard expansion: % echo * Applications Desktop Documents Downloads Library Movies Music Pictures Public bin If I explicitly ask for dot files, I get them: ...
6
votes
2answers
935 views

How can I make bash not match `.` and `..` with `.*`

When I try to match all dot files in a directory with .* it seems to have a nasty side-effect: besides matching all (real) files and directories, it matches . and ... bash-3.2$ mv test/.* dest/ mv: ...
6
votes
2answers
4k views

Copy all dotfiles except for `.git` and `..`

I am aware of using .[!.]* to refer to all dotfiles in a directory with the exception of .., but how might one refer to all dotfiles except for .. and .git? I have tried several variations on .[!.||....
6
votes
1answer
480 views

Alphabetizing names in `ls` alias with .files not intermingled

I am currently using the following ls alias: alias ls='ls -alhGkpsq --color=auto'. This results in following directory listing. [03:35] bryson@brys ~ :$ ls total 48K 4.0K drwx------ 4 bryson 4.0K ...
5
votes
4answers
7k views

How to delete all files in a current directory starting with a dot?

I use Ubuntu 14.04 and in a terminal I became root with sudo su and I wanted to delete root's trash manually. It deleted everything except for a few files that start with a dot. Like .htaccess etc. So ...
4
votes
1answer
447 views

Dot in front of file [duplicate]

If there is a file and the filename starts with a dot in front of it. Does that mean that you created the file and you are hiding stuff in it or can the files get created on their own without you ...
4
votes
4answers
432 views

How can I make source-highlight colorize .dotfiles by default?

Normally when I cat a file like this it's hard to read without colorizing. I've managed to get cat to use source-highlight like this: cdc() { for fn in "$@"; do source-highlight --out-format=...
4
votes
3answers
687 views

bash moving hidden files, reset dotglob?

I wanted to move all files, including starting with dot (hidden) and folders (recursively). So I used the following commands shopt -s dotglob nullglob mv ~/public/* ~/public_html/ and it worked. ...
4
votes
2answers
6k views

rm wildcard not working

I want to delete all .swp files recursively. However: rm -r *.swp Gives: rm: cannot remove ‘*.swp’: No such file or directory Just to be sure, ls -all gives: total 628 drwxr--r--. 8 przecze ...
4
votes
1answer
269 views

Please explain what's going on in my XMonad config file

I'm new to XMonad and I'd like to understand what's going on in this config file. It is a working config file, nothing is broken. I understand what each setting does but I don't understand what's ...
4
votes
1answer
856 views

Is there a more elegant way to unlink two tmux clients sharing a session from inside tmux?

This is almost a code-review question, but very *nixy and more about configuration than code. For years since I switched to tmux from screen I've had a couple of nagging issues that I could not make ...
3
votes
8answers
6k views

grepping dotfiles with -R correctly?

From time to time I need to find a culprit in an unknown dotfile and instead of trying to figure out which package is to be blamed (e.g. xfce4 or thunar?) and what is their naming convention (.app vs ....
3
votes
7answers
899 views

for loop in bash lists dot and double dot folders [duplicate]

for f in ~/common/.*; do echo $f done The entries listed are, /home/sk/common/. #undesired /home/sk/common/.. #undesired /home/sk/common/.aliasrc And i am putting a ugly hack ...
3
votes
4answers
21k views

How to show only hidden directories, and then find hidden files separately

I'm trying to list all the hidden files in a directory, but not other directories, and I am trying to do this using only ls and grep. ls -a | egrep "^\." This is what I have so far, but the problem ...
3
votes
1answer
63 views

Which files in $HOME defines the user preferences in gnome?

I'm backup/syncing my dotfiles in my $HOME-Directory via git. I don't want to sync everything of course, so I ignore everything via .gitignore and re-add the important files. * !.bash* .*.swp ....
3
votes
2answers
1k views

Is there a way to have ls show hidden files for only certain directories?

I have a directory where regardless of user or options selected, I would like it to always show hidden files. I know the -a option will show hidden files. I just want to automate the decision on ...
3
votes
2answers
509 views

Dealing with machine specific configs when using git for configuration management

I've been using a git repo for managing my systems configs for a while now. I used the documentation on Digital Ocean tutorials here. Pretty much I have a remote repo on a server. Do a git clone of ...
3
votes
1answer
4k views

Elegant Way To Store Dotfiles on GitHub

I need an elegant solution to store my dotfiles on GitHub for easy access. I tried to create a dotfiles directory and symlink all the dotfiles into there. Then I tried adding the symlinks to git and ...
3
votes
2answers
407 views

Shell-independent way to cp dotfiles from a folder to another [duplicate]

I have two existing directories : foo: directory with dotfiles in it foo2: empty directory I would like to have a solution to copy all dotfiles in foo to foo2. I would like a solution that is not ...
3
votes
1answer
209 views

Keeping dotfiles in sync for different folders

I am using Dropbox for storing my dotfiles from which I create soft links to my home directory. For configuration files which I do edit by myself it works very good, however applications like firefox ...
2
votes
7answers
3k views

grep ignores files starting with dot [duplicate]

Let me give an example: $ echo Hello > file1 $ echo Hello > file2 $ echo Hello > .file3 $ grep Hello * 2>/dev/null file1:Hello file2:Hello Here you can see the grep ignored .file3 which ...
2
votes
6answers
164 views

How do I match only dotfiles in bash? [duplicate]

rm -rf .* will only not end horribly because rm refuses to delete . and ... How do I exclude these special directories from a glob pattern? This is not solved by dotglob since I want to match only ...
2
votes
6answers
2k views

UNIX: How to change all hidden files to visible in a multiple sub directories

I have hundreds of sub directories in a directory that all have hidden files in them that I need to remove the period at the beginning of them to make them visible. I found a command to go into each ...
2
votes
2answers
175 views

ssh directory disappears after `mv ssh .ssh`

I was in user home directory , and wanted to rename the ssh folder into .ssh folder. I tried this. rachit@DESKTOP-ENS2652:~/ssh$ ls some-machine some-machine.pub rachit@DESKTOP-ENS2652:~/ssh$ cd .. ...
2
votes
1answer
998 views

sudo ls not showing hidden files on Linux

Today I discovered that sudo ls shows hidden files (that is, those that have names starting with .) on OS X. This surprised me so much that I asked a question about this behaviour, which I still find ...
2
votes
1answer
4k views

Remove everything within directory using for loop

I am trying to remove large amount of mails (mostly mail delivery failed) from my server using rm -rf /home/*/mail/new/* And I am getting -bash: /usr/bin/rm: Argument list too long I tried using ...
2
votes
1answer
596 views

dotfiles: can/should(?) gnu stow make hard links, so I can still use xfce settings gui programs

I'm trying to manage my dotfiles under version control. My dotfiles repos contains a xfce-base folder, this folder contains the .config/xfce4/.../xy-setting.xml stuff. I can stow, or better, symlink ...