The current directory . at the end of /etc/skel/. combined with the -r flag, recursively copies all files, including hidden files and directories, to the target directory, but avoids copying directories . and .. because they are specific to the current directory and are not included when copying the contents.
I came here having Googled for a solution to the same problem, then I realized that it's easy to do with find. The advantage it doesn't depend on the shell, or special utilities that may not be installed.
Note that there is a command-line trick (works in, at least, sh, bash, and ksh): Just suffix the from directory with a slash. This will pour the contents of the from directory into the to directory (ironically, I had first learned about this trick when using rsync).
As of at least K3b 2.0.3, there is a question box that pops up when the directory is added to the project, that ask if you want to include hidden files ... there is also a question that pops up to ask about including links.Nice stuff!
The filesystem looks like an upside down tree. The topmost directoryis the root directory that holds everything else. Werefer to it using a slash character, /, on its own; thischaracter is the leading slash in /Users/nelle.
We know that our current working directory /Users/nelleis stored inside /Users because /Users is thefirst part of its name. Similarly, we know that /Users isstored inside the root directory / because its name beginswith /.
ls prints the names of the files and directories in thecurrent directory. We can make its output more comprehensible by usingthe -F option which tells lsto classify the output by adding a marker to file and directory names toindicate what they are:
Some commands are built in to the Bash shell, rather than existing asseparate programs on the filesystem. One example is the cd(change directory) command. If you get a message likeNo manual entry for cd, try help cd instead.The help command is how you get usage information for Bashbuilt-ins.
Of course, there is a third way to access help for commands:searching the internet via your web browser. When using internet search,including the phrase unix man page in your search querywill help to find relevant results.
By default, ls lists the contents of a directory inalphabetical order by name. The command ls -t lists itemsby time of last change instead of alphabetically. The commandls -r lists the contents of a directory in reverse order.Which file is displayed last when you combine the -t and-r options? Hint: You may need to use the -loption to see the last changed dates.
Note that if a directory named Desktop does not exist inyour current working directory, this command will return an error.Typically, a Desktop directory exists in your homedirectory, which we assume is the current working directory of your bashshell.
Your output should be a list of all the files and sub-directories inyour Desktop directory, including the shell-lesson-datadirectory you downloaded at the setup for thislesson. (On most systems, the contents of the Desktopdirectory in the shell will show up as icons in a graphical userinterface behind all the open windows. See if this is the case foryou.)
In addition to the hidden directories .. and., you may also see a file called.bash_profile. This file usually contains shellconfiguration settings. You may also see other files and directoriesbeginning with .. These are usually files and directoriesthat are used to configure different programs on your computer. Theprefix . is used to prevent these configuration files fromcluttering the terminal when a standard ls command isused.
So far, when specifying directory names, or even a directory path (asabove), we have been using relative paths. When you usea relative path with a command like ls or cd,it tries to find that location from where we are, rather than from theroot of the file system.
However, it is possible to specify the absolute pathto a directory by including its entire path from the root directory,which is indicated by a leading slash. The leading / tellsthe computer to follow the path from the root of the file system, so italways refers to exactly one directory, no matter where we are when werun the command.
You might sometimes see options being referred to asswitches or flags, especially foroptions that take no argument. In this lesson we will stick with usingthe term option.
The root directory is the top level, and is denoted by a slash (/). Other directories are created below the root directory - typically, you will find a "bin" directory, which contains binary files required for commands and processes like those we'll cover next, as well as a "tmp" directory for temporary files, and directories like "home" that contain information for individual users.
In the online simulator, we are not assigned a user account in the home directory. Instead, we will be working from the "root" subfolder. The other directories that we will explore in the simulator are read-only and un-editable.
"pwd" is a command that stands for "print working directory". You can use this command to find out your location within the Unix file structure at any time. Here we can see that we are in "root" which is a subdirectory of the main root directory, "/".
What do we know about these listed entries? Are they directories or files? Can you edit them, or are they read-only? The ls command by itself simply lists all the contents of a directory. You can add options to it to find out more information.
Try typing "ls -l" into the simulator and press enter. What kind of information are we shown now? The image below shows some examples of the standard information that is returned with the -l, long-format option.
Thus, the first entry in the listed contents above is a directory in which the owner, group and all others have read, write and execute privileges. The second entry is a regular file that can be read, written to, and executed by the owner but is read-only for the group and other users.
Returning to our long listing in the current directory within the online linux simulator, we can see that "hello.c" is a regular file (a C program, in fact), and "dos" is a symbolic link to another "dos" directory that is in the "root" directory.
Type "cd" followed by a space and the name of a directory you want to change to (dos) into the simulator and press enter. Remember: all commands must be followed by a space before their target file/directory or process!
Now you should be in the "dos" directory. Notice that the prompt changed to show you the current directory. This is not always the case in Unix. Explore the contents of the directory with some of the listing commands we introduced earlier and then answer the question below.
Next let's change to the asm-1.9 directory. There are several files listed in that directory. In addition to easily listing all the contents in a directory, Unix allows users to quickly show the contents of individual files. One way to do this is the concatenate command, "cat". Try entering "cat" followed by one of the filenames in asm-1.9, and then press enter. Readme.txt is an easy one to view (don't forget a space between the command and filename!)
Contents of long files can be viewed stepwise by using the "more" command. This is similar to "cat", but it prints the file contents to screen and allows the user to step through them using the spacebar. To exit the "more" command, press "q" for quit.
Since you are in a sub-directory of the directory you're trying to access, the "cd" command must be used with an absolute path, or an appropriate relative one - we cannot simply type "cd directoryname" like we did before, because the directory we want to access is no longer below our location in the directory structure.
To change back to the "dos" directory, we can use the absolute address "cd /root/dos" or we can use a relative path "cd .." where ".." indicates the directory above your current working directory. "." is always the current directory. To access the directory above /root from the asm-1.9 directory, we could type "cd ../.." as that directory is two directories up from our current location.
Every file (and directory) has an owner, an associated Unix group, and a set of permission flags that specify separate read, write, and execute permissions for the "user" (owner), "group", and "other". Group permissions apply to all users who belong to the group associated with the file. "Other" is also sometimes known as "world" permissions, and applies to all users who can login to the system. The command ls -l displays the permissions and associated group for any file. Here is an example of the output of this command:
This is a directory named "private", owned by user elvis and associated with Unix group elvis. The directory has read, write, and execute permissions for the owner, and no permissions for any other user.
This is a directory named "share", owned by user elvis and associated with group bigsci. The owner can read and write the directory; all members of the file group bigsci can list the contents of the directory. Presumably, this directory would contain files that also have "group read" permissions.
This is a directory named "public", owned by user elvis and associated with group bigsci. The owner can read and write the directory; all other users can only read the contents of the directory. A directory such as this would most likely contain files that have "world read" permissions.
When a file is created, the permission flags are set according to the file mode creation mask, which can be set using the umask command. The file mode creation mask (sometimes referred to as "the umask") is a three-digit octal value whose nine bits correspond to fields 2-10 of the permission flags. The resulting permissions are calculated via the bitwise AND of the unary complement of the argument (using bitwise NOT) and the default permissions specified by the shell (typically 666 for files and 777 for directories). Common useful values are:
c80f0f1006