Skip to main content
51 votes
Accepted

How do I apply the changes to the .zshrc file after editing it?

Restart zsh Zsh reads .zshrc when it starts. You don't need to log out and log back in. Just closing the terminal and opening a new one gives you your new .zshrc in this new terminal. But you can ...
Gilles 'SO- stop being evil''s user avatar
40 votes
Accepted

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

The behaviour is a logical result of the documented algorithm for cp -R. See POSIX, step 2f: The files in the directory source_file shall be copied to the directory dest_file, taking the four steps (...
Stephen Kitt's user avatar
23 votes
Accepted

SSHing into system with ZSH as default shell doesn't run /etc/profile

ZSH just works in this way. /etc/profile is NOT an init file for ZSH. ZSH uses /etc/zprofile and ~/.zprofile. Init files for ZSH: /etc/zshenv ~/.zshenv login mode: /etc/zprofile ~/.zprofile ...
Simba's user avatar
  • 1,992
16 votes
Accepted

When should I use .bashrc and when .profile?

.profile is read by every login shell, .xxxrc is read by every interactive shell after reading .profile. You need to decide yourself depending on what you like to add. A good idea is to put ...
schily's user avatar
  • 19.7k
16 votes

Dot in front of file

This can likely be explained by a google post by Rob Pike about the origin of hidden files. In the early days of Unix there was no concept of hidden files but the files . and .. existed to ...
jesse_b's user avatar
  • 41.5k
12 votes

When should I use .bashrc and when .profile?

Bash has a pretty complicated logic on which scripts it runs and when. But it mostly boils down to: if you have settings that are inherited from parent process to child (environment variables, ...
telcoM's user avatar
  • 114k
11 votes

How to match * with hidden files inside a directory

Another option is available here : du -sm .[!.]* *
Fábio's user avatar
  • 269
7 votes
Accepted

Grouping hidden files and directories with ls

Use -v for natural sort. e.g. ls -lG --color --group-directories-first -A -v Note while they are sorted into their own "group", the .hidden directories will appear before the visible directories, ...
cas's user avatar
  • 84k
7 votes

SSHing into system with ZSH as default shell doesn't run /etc/profile

sshd runs a login shell when the client doesn't send any command to run. That's to mimic the behaviour of rsh which was calling the rlogind service instead of the rshd one when not given any command ...
Stéphane Chazelas's user avatar
7 votes

Dot file and an adjacent identically named file without dot?

Is it bad practice to have a dot file and an adjacent identically named file without dot? No. The "semantics" of dotfiles are (and this is very conventional and not very consistent) that ...
Marcus Müller's user avatar
6 votes

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

With GNU find: find /some/path -type f -name '.*' -execdir sh -c 'mv -i "$0" "./${0#./.}"' {} \; With Perl rename: find /some/path -type f -name '.*' -exec prename -i -n 's!.*/\K\.!!' {} + (remove -...
Satō Katsura's user avatar
6 votes

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

find /path/to/dir -type f -name ".*" -delete
davidcondrey's user avatar
6 votes
Accepted

Difference between GNU find -not and GNU find -prune -o -print

First, note that -not is a GNU extension and is the equivalent of the standard ! operator. It has virtually no advantage over !. The -prune predicate always evaluates to true and affects the way find ...
Stéphane Chazelas's user avatar
6 votes

Opposite of `--adopt` option for GNU Stow?

I ran into the same limitation and I've found a work-flow that works well with the --adopt option. As stated in the Stow documentation: ...it allows files in the target tree, with potentially ...
mauedu's user avatar
  • 61
6 votes
Accepted

Do dotfiles require the initial dot?

No, it's not a dotfile, since its name doesn't start with a dot. It's simply a configuration file. The property of dotfiles is that they don't appear by default in the output of the ls command, to ...
dr_'s user avatar
  • 32.4k
5 votes
Accepted

Good way to prevent student from messing program settings in /home/user

Totally different approach: Create a group students, give each student his own account with group membership in students. Have a script that restores a given home directory from a template to a known ...
dirkt's user avatar
  • 33.4k
5 votes
Accepted

How do I match only dotfiles in bash?

With bash, setting the GLOBIGNORE special variable is some non-empty value is enough to make it ignore . and .. when expanding globs. From the Bash docs: The GLOBIGNORE shell variable may be used to ...
muru's user avatar
  • 77.9k
5 votes
Accepted

Is there a totally empty Bash file I can use (or create) to extend .bashrc and .profile?

I know that by principle, one shouldn't change .bashrc and common changes like creating an alias should better be done in .profile instead. This doesn't make any sense. You probably misunderstood what ...
Gilles 'SO- stop being evil''s user avatar
5 votes
Accepted

How do configure ZSH commands substition to not use backticks (`)?

Wrap the backticks in strong quotes to divest them of their subshelly powers: $ echo '`echo`' `echo` Beware, though, the contraction wrapped in strong quotes: $ echo 'I can't process this.' > Oh ...
DopeGhoti's user avatar
  • 79.2k
5 votes

How do I apply the changes to the .zshrc file after editing it?

Changes to a shells initialisation files will be active in the next shell that you start, for example if you bring up a new graphical terminal or log out and in again. If you've made changes that ...
Kusalananda's user avatar
  • 356k
5 votes

Difference between GNU find -not and GNU find -prune -o -print

The -prune predicate in find removes a branch of the search tree. Therefore, using -prune as in the first command in your question would only give you the same results as your second command if ...
Kusalananda's user avatar
  • 356k
5 votes
Accepted

What language do config files use?

There's no global standard. They can be (and are) all different syntaxes. For example, the bashrc is simply a bash script, the vimrc a vimscript script, i3 uses its own syntax that's pretty close to ...
Marcus Müller's user avatar
4 votes

Good way to prevent student from messing program settings in /home/user

Setting Immutable and Undeletable attributes on the dotfiles via chattr should help. See man chattr or the wikipedia entry for chattr Does not prevent changing or deleting totally since a user can ...
martijn's user avatar
  • 41
4 votes

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

I find that this works well for bash and there's no need to change shell options mv sourcedir/{*,.[^.]*} destdir/ EDIT: So as G-man stated, my original answer is not posix compliant and is pretty ...
cmndr sp0ck's user avatar
4 votes

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

When you run cp -R src/foo dest, you'll get dest/foo. So if directory dest/foo does not exist, cp will create it, and then copy the contents of src/foo to dest/foo. When you run cp -R src/. dest, cp ...
telcoM's user avatar
  • 114k
4 votes

How do I apply the changes to the .zshrc file after editing it?

You could source the new file, which would work for some changes, possibly including updating the PATH variable (depending on other lines). However, sourcing it would simply run .zshrc again, and you ...
Sparhawk's user avatar
  • 20.5k
4 votes
Accepted

Tmux doesn't read `~/.config/tmux/tmux.conf` by default, so where?

Despite the two answers with the traditional tmux config locations, tmux 3.1 and later does support ~/.config/tmux/tmux.conf, although it's not mentioned in the man page. See the release notes here. ...
NotTheDr01ds's user avatar
  • 4,012

Only top scored, non community-wiki answers of a minimum length are eligible