In this episode we will learn about creating and moving files and directories, using the
haiku.txt LittleWomen.txt thesis/
0 directory as an example.Step one: see where we are and what we already have
We should still be in the
haiku.txt LittleWomen.txt thesis/
1 directory on the Desktop, which we can check using:$ pwd
/Users/nelle/Desktop/shell-lesson-data
Next we’ll move to the
haiku.txt LittleWomen.txt thesis/
0 directory and see what it contains:$ cd exercise-data/writing/
$ ls -F
haiku.txt LittleWomen.txt
Create a directory
Let’s create a new directory called
haiku.txt LittleWomen.txt thesis/
3 using the command haiku.txt LittleWomen.txt thesis/
4 [which has no output]:$ mkdir thesis
As you might guess from its name,
haiku.txt LittleWomen.txt thesis/
5 means ‘make directory’. Since haiku.txt LittleWomen.txt thesis/
3 is a relative path [i.e., does not have a leading slash, like haiku.txt LittleWomen.txt thesis/
7], the new directory is created in the current working directory:$ ls -F
haiku.txt LittleWomen.txt thesis/
Since we’ve just created the
haiku.txt LittleWomen.txt thesis/
3 directory, there’s nothing in it yet:$ ls -F thesis
Note that
haiku.txt LittleWomen.txt thesis/
5 is not limited to creating single directories one at a time. The $ ls -F thesis
0 option allows haiku.txt LittleWomen.txt thesis/
5 to create a directory with nested subdirectories in a single operation:$ mkdir -p ../project/data ../project/results
The
$ ls -F thesis
2 option to the $ ls -F thesis
3 command will list all nested subdirectories within a directory. Let’s use $ ls -F thesis
4 to recursively list the new directory hierarchy we just created in the $ ls -F thesis
5 directory:/Users/nelle/Desktop/shell-lesson-data
0/Users/nelle/Desktop/shell-lesson-data
1Two ways of doing the same thing
Using the shell to create a directory is no different than using a file explorer. If you open the current directory using your operating system’s graphical file explorer, the
3 directory will appear there too. While the shell and the file explorer are two different ways of interacting with the files, the files and directories themselves are the same.haiku.txt LittleWomen.txt thesis/
Good names for files and directories
Complicated names of files and directories can make your life painful when working on the command line. Here we provide a few useful tips for the names of your files and directories.
Don’t use spaces.
Spaces can make a name more meaningful, but since spaces are used to separate arguments on the command line it is better to avoid them in names of files and directories. You can use
7 or$ ls -F thesis
8 instead [e.g.$ ls -F thesis
9 rather than$ ls -F thesis
0]. To test this out, try typing$ mkdir -p ../project/data ../project/results
1and see what directory [or directories!] are made when you check with$ mkdir -p ../project/data ../project/results
2.$ mkdir -p ../project/data ../project/results
Don’t begin the name with
7 [dash].$ ls -F thesis
Commands treat names starting with
7 as options.$ ls -F thesis
Stick with letters, numbers,
5 [period or ‘full stop’],$ mkdir -p ../project/data ../project/results
7 [dash] and$ ls -F thesis
8 [underscore].$ ls -F thesis
Many other characters have special meanings on the command line. We will learn about some of these during this lesson. There are special characters that can cause your command to not work as expected and can even result in data loss.
If you need to refer to names of files or directories that have spaces or other special characters, you should surround the name in quotes [
8].$ mkdir -p ../project/data ../project/results
Create a text file
Let’s change our working directory to
haiku.txt LittleWomen.txt thesis/
3 using /Users/nelle/Desktop/shell-lesson-data
00, then run a text editor called Nano to create a file called /Users/nelle/Desktop/shell-lesson-data
01:/Users/nelle/Desktop/shell-lesson-data
2Which Editor?
When we say, ‘
02 is a text editor’ we really do mean ‘text’: it can only work with plain character data, not tables, images, or any other human-friendly media. We use it in examples because it is one of the least complex text editors. However, because of this trait, it may not be powerful enough or flexible enough for the work you need to do after this workshop. On Unix systems [such as Linux and macOS], many programmers use Emacs or Vim [both of which require more time to learn], or a graphical editor such as Gedit. On Windows, you may wish to use Notepad++. Windows also has a built-in editor called/Users/nelle/Desktop/shell-lesson-data
03 that can be run from the command line in the same way as/Users/nelle/Desktop/shell-lesson-data
02 for the purposes of this lesson./Users/nelle/Desktop/shell-lesson-data
No matter what editor you use, you will need to know where it searches for and saves files. If you start it from the shell, it will [probably] use your current working directory as its default location. If you use your computer’s start menu, it may want to save files in your desktop or documents directory instead. You can change this by navigating to another directory the first time you ‘Save As…’
Let’s type in a few lines of text. Once we’re happy with our text, we can press Ctrl+O [press the Ctrl or Control key and, while holding it down, press the O key] to write our data to disk [we’ll be asked what file we want to save this to: press Return to accept the suggested default of
/Users/nelle/Desktop/shell-lesson-data
01].Once our file is saved, we can use Ctrl+X to quit the editor and return to the shell.
Control, Ctrl, or ^ Key
The Control key is also called the ‘Ctrl’ key. There are various ways in which using the Control key may be described. For example, you may see an instruction to press the Control key and, while holding it down, press the X key, described as any of:
06/Users/nelle/Desktop/shell-lesson-data
07/Users/nelle/Desktop/shell-lesson-data
08/Users/nelle/Desktop/shell-lesson-data
09/Users/nelle/Desktop/shell-lesson-data
10/Users/nelle/Desktop/shell-lesson-data
11/Users/nelle/Desktop/shell-lesson-data
In nano, along the bottom of the screen you’ll see
12. This means that you can use/Users/nelle/Desktop/shell-lesson-data
13 to get help and/Users/nelle/Desktop/shell-lesson-data
14 to save your file./Users/nelle/Desktop/shell-lesson-data
/Users/nelle/Desktop/shell-lesson-data
02 doesn’t leave any output on the screen after it exits, but $ ls -F thesis
3 now shows that we have created a file called /Users/nelle/Desktop/shell-lesson-data
01:/Users/nelle/Desktop/shell-lesson-data
3/Users/nelle/Desktop/shell-lesson-data
4Creating Files a Different Way
We have seen how to create text files using the
02 editor. Now, try the following command:/Users/nelle/Desktop/shell-lesson-data
5/Users/nelle/Desktop/shell-lesson-data
What did the
19 command do? When you look at your current directory using the GUI file explorer, does the file show up?/Users/nelle/Desktop/shell-lesson-data
Use
20 to inspect the files. How large is/Users/nelle/Desktop/shell-lesson-data
21?/Users/nelle/Desktop/shell-lesson-data
When might you want to create a file this way?
Solution
The
19 command generates a new file called/Users/nelle/Desktop/shell-lesson-data
21 in your current directory. You can observe this newly generated file by typing/Users/nelle/Desktop/shell-lesson-data
3 at the command line prompt.$ ls -F thesis
21 can also be viewed in your GUI file explorer./Users/nelle/Desktop/shell-lesson-data
When you inspect the file with
20, note that the size of/Users/nelle/Desktop/shell-lesson-data
21 is 0 bytes. In other words, it contains no data. If you open/Users/nelle/Desktop/shell-lesson-data
21 using your text editor it is blank./Users/nelle/Desktop/shell-lesson-data
Some programs do not generate output files themselves, but instead require that empty files have already been generated. When the program is run, it searches for an existing file to populate with its output. The touch command allows you to efficiently generate a blank text file to be used by such programs.
To avoid confusion later on, we suggest removing the file you’ve just created before proceding with the rest of the episode, otherwise future outputs may vary from those given in the lesson. To do this, use the following command:
6/Users/nelle/Desktop/shell-lesson-data
What’s In A Name?
You may have noticed that all of Nelle’s files are named ‘something dot something’, and in this part of the lesson, we always used the extension
29. This is just a convention: we can call a file/Users/nelle/Desktop/shell-lesson-data
30 or almost anything else we want. However, most people use two-part names most of the time to help them [and their programs] tell different kinds of files apart. The second part of such a name is called the filename extension and indicates what type of data the file holds:/Users/nelle/Desktop/shell-lesson-data
29 signals a plain text file,/Users/nelle/Desktop/shell-lesson-data
32 indicates a PDF document,/Users/nelle/Desktop/shell-lesson-data
33 is a configuration file full of parameters for some program or other,/Users/nelle/Desktop/shell-lesson-data
34 is a PNG image, and so on./Users/nelle/Desktop/shell-lesson-data
This is just a convention, albeit an important one. Files contain bytes: it’s up to us and our programs to interpret those bytes according to the rules for plain text files, PDF documents, configuration files, images, and so on.
Naming a PNG image of a whale as
35 doesn’t somehow magically turn it into a recording of whale song, though it might cause the operating system to try to open it with a music player when someone double-clicks it./Users/nelle/Desktop/shell-lesson-data
Moving files and directories
Returning to the
/Users/nelle/Desktop/shell-lesson-data
36 directory,/Users/nelle/Desktop/shell-lesson-data
7In our
haiku.txt LittleWomen.txt thesis/
3 directory we have a file /Users/nelle/Desktop/shell-lesson-data
01 which isn’t a particularly informative name, so let’s change the file’s name using /Users/nelle/Desktop/shell-lesson-data
39, which is short for ‘move’:/Users/nelle/Desktop/shell-lesson-data
8The first argument tells
/Users/nelle/Desktop/shell-lesson-data
39 what we’re ‘moving’, while the second is where it’s to go. In this case, we’re moving /Users/nelle/Desktop/shell-lesson-data
41 to /Users/nelle/Desktop/shell-lesson-data
42, which has the same effect as renaming the file. Sure enough, $ ls -F thesis
3 shows us that haiku.txt LittleWomen.txt thesis/
3 now contains one file called /Users/nelle/Desktop/shell-lesson-data
45:/Users/nelle/Desktop/shell-lesson-data
9$ cd exercise-data/writing/
0One must be careful when specifying the target file name, since
/Users/nelle/Desktop/shell-lesson-data
39 will silently overwrite any existing file with the same name, which could lead to data loss. An additional option, /Users/nelle/Desktop/shell-lesson-data
47 [or /Users/nelle/Desktop/shell-lesson-data
48], can be used to make /Users/nelle/Desktop/shell-lesson-data
39 ask you for confirmation before overwriting.Note that
/Users/nelle/Desktop/shell-lesson-data
39 also works on directories.Let’s move
/Users/nelle/Desktop/shell-lesson-data
45 into the current working directory. We use /Users/nelle/Desktop/shell-lesson-data
39 once again, but this time we’ll use just the name of a directory as the second argument to tell /Users/nelle/Desktop/shell-lesson-data
39 that we want to keep the filename but put the file somewhere new. [This is why the command is called ‘move’.] In this case, the directory name we use is the special directory name $ mkdir -p ../project/data ../project/results
5 that we mentioned earlier.$ cd exercise-data/writing/
1The effect is to move the file from the directory it was in to the current working directory.
$ ls -F thesis
3 now shows us that haiku.txt LittleWomen.txt thesis/
3 is empty:/Users/nelle/Desktop/shell-lesson-data
9$ cd exercise-data/writing/
3Alternatively, we can confirm the file
/Users/nelle/Desktop/shell-lesson-data
45 is no longer present in the haiku.txt LittleWomen.txt thesis/
3 directory by explicitly trying to list it:$ cd exercise-data/writing/
4$ cd exercise-data/writing/
5$ ls -F thesis
3 with a filename or directory as an argument only lists the requested file or directory. If the file given as the argument doesn’t exist, the shell returns an error as we saw above. We can use this to see that /Users/nelle/Desktop/shell-lesson-data
45 is now present in our current directory:$ cd exercise-data/writing/
6$ cd exercise-data/writing/
0Moving Files to a new folder
After running the following commands, Jamie realizes that she put the files
61 and/Users/nelle/Desktop/shell-lesson-data
62 into the wrong folder. The files should have been placed in the/Users/nelle/Desktop/shell-lesson-data
63 folder./Users/nelle/Desktop/shell-lesson-data
8$ cd exercise-data/writing/
Fill in the blanks to move these files to the
64 folder [i.e. the one she forgot to put them in]/Users/nelle/Desktop/shell-lesson-data
9$ cd exercise-data/writing/
Solution
0$ ls -F
Recall that
65 refers to the parent directory [i.e. one above the current directory] and that/Users/nelle/Desktop/shell-lesson-data
5 refers to the current directory.$ mkdir -p ../project/data ../project/results
Copying files and directories
The
/Users/nelle/Desktop/shell-lesson-data
67 command works very much like /Users/nelle/Desktop/shell-lesson-data
39, except it copies a file instead of moving it. We can check that it did the right thing using $ ls -F thesis
3 with two paths as arguments — like most Unix commands, $ ls -F thesis
3 can be given multiple paths at once:$ ls -F
1$ ls -F
2We can also copy a directory and all its contents by using the recursive option
/Users/nelle/Desktop/shell-lesson-data
71, e.g. to back up a directory:$ ls -F
3We can check the result by listing the contents of both the
haiku.txt LittleWomen.txt thesis/
3 and /Users/nelle/Desktop/shell-lesson-data
73 directory:$ ls -F
4$ ls -F
5Renaming Files
Suppose that you created a plain-text file in your current directory to contain a list of the statistical tests you will need to do to analyze your data, and named it:
74/Users/nelle/Desktop/shell-lesson-data
After creating and saving this file you realize you misspelled the filename! You want to correct the mistake, which of the following commands could you use to do so?
75/Users/nelle/Desktop/shell-lesson-data
76/Users/nelle/Desktop/shell-lesson-data
77/Users/nelle/Desktop/shell-lesson-data
78/Users/nelle/Desktop/shell-lesson-data
Solution
- No. While this would create a file with the correct name, the incorrectly named file still exists in the directory and would need to be deleted.
- Yes, this would work to rename the file.
- No, the period[.] indicates where to move the file, but does not provide a new file name; identical file names cannot be created.
- No, the period[.] indicates where to copy the file, but does not provide a new file name; identical file names cannot be created.
Moving and Copying
What is the output of the closing
3 command in the sequence shown below?$ ls -F thesis
$ pwd
7$ ls -F
3/Users/nelle/Desktop/shell-lesson-data
9$ ls -F
0haiku.txt LittleWomen.txt
80/Users/nelle/Desktop/shell-lesson-data
81/Users/nelle/Desktop/shell-lesson-data
82/Users/nelle/Desktop/shell-lesson-data
83/Users/nelle/Desktop/shell-lesson-data
Solution
We start in the
84 directory, and create a new folder called/Users/nelle/Desktop/shell-lesson-data
81. The second line moves [/Users/nelle/Desktop/shell-lesson-data
39] the file/Users/nelle/Desktop/shell-lesson-data
87 to the new folder [/Users/nelle/Desktop/shell-lesson-data
81]. The third line makes a copy of the file we just moved. The tricky part here is where the file was copied to. Recall that/Users/nelle/Desktop/shell-lesson-data
65 means ‘go up a level’, so the copied file is now in/Users/nelle/Desktop/shell-lesson-data
90. Notice that/Users/nelle/Desktop/shell-lesson-data
65 is interpreted with respect to the current working directory, not with respect to the location of the file being copied. So, the only thing that will show using ls [in/Users/nelle/Desktop/shell-lesson-data
84] is the recombined folder./Users/nelle/Desktop/shell-lesson-data
- No, see explanation above.
83 is located at/Users/nelle/Desktop/shell-lesson-data
90/Users/nelle/Desktop/shell-lesson-data
- Yes
- No, see explanation above.
87 is located at/Users/nelle/Desktop/shell-lesson-data
96/Users/nelle/Desktop/shell-lesson-data
- No, see explanation above.
83 is located at/Users/nelle/Desktop/shell-lesson-data
90/Users/nelle/Desktop/shell-lesson-data
Removing files and directories
Returning to the
/Users/nelle/Desktop/shell-lesson-data
36 directory, let’s tidy up this directory by removing the /Users/nelle/Desktop/shell-lesson-data
45 file we created. The Unix command we’ll use for this is $ cd exercise-data/writing/
01 [short for ‘remove’]:haiku.txt LittleWomen.txt
1We can confirm the file has gone using
$ ls -F thesis
3:$ cd exercise-data/writing/
6haiku.txt LittleWomen.txt
3Deleting Is Forever
The Unix shell doesn’t have a trash bin that we can recover deleted files from [though most graphical interfaces to Unix do]. Instead, when we delete files, they are unlinked from the file system so that their storage space on disk can be recycled. Tools for finding and recovering deleted files do exist, but there’s no guarantee they’ll work in any particular situation, since the computer may recycle the file’s disk space right away.
Using
01 Safely$ cd exercise-data/writing/
What happens when we execute
04? Why would we want this protection when using$ cd exercise-data/writing/
01?$ cd exercise-data/writing/
Solution
4haiku.txt LittleWomen.txt
The
06 option will prompt before [every] removal [use Y to confirm deletion or N to keep the file]. The Unix shell doesn’t have a trash bin, so all the files removed will disappear forever. By using the$ cd exercise-data/writing/
06 option, we have the chance to check that we are deleting only the files that we want to remove.$ cd exercise-data/writing/
If we try to remove the
haiku.txt LittleWomen.txt thesis/
3 directory using $ cd exercise-data/writing/
09, we get an error message:haiku.txt LittleWomen.txt
5haiku.txt LittleWomen.txt
6This happens because
$ cd exercise-data/writing/
01 by default only works on files, not directories.$ cd exercise-data/writing/
01 can remove a directory and all its contents if we use the recursive option /Users/nelle/Desktop/shell-lesson-data
71, and it will do so without any confirmation prompts:haiku.txt LittleWomen.txt
7Given that there is no way to retrieve files deleted using the shell,
$ cd exercise-data/writing/
13 should be used with great caution [you might consider adding the interactive option $ cd exercise-data/writing/
14].Operations with multiple files and directories
Oftentimes one needs to copy or move several files at once. This can be done by providing a list of individual filenames, or specifying a naming pattern using wildcards.
Copy with Multiple Filenames
For this exercise, you can test the commands in the
15 directory.$ cd exercise-data/writing/
In the example below, what does
67 do when given several filenames and a directory name?/Users/nelle/Desktop/shell-lesson-data
8haiku.txt LittleWomen.txt
In the example below, what does
67 do when given three or more file names?/Users/nelle/Desktop/shell-lesson-data
9haiku.txt LittleWomen.txt
0$ mkdir thesis
1$ mkdir thesis
Solution
If given more than one file name followed by a directory name [i.e. the destination directory must be the last argument],
67 copies the files to the named directory./Users/nelle/Desktop/shell-lesson-data
If given three file names,
67 throws an error such as the one below, because it is expecting a directory name as the last argument./Users/nelle/Desktop/shell-lesson-data
2$ mkdir thesis
Using wildcards for accessing multiple files at once
Wildcards
20 is a wildcard, which matches zero or more characters. Let’s consider the$ cd exercise-data/writing/
21 directory:$ cd exercise-data/writing/
22 matches$ cd exercise-data/writing/
23,$ cd exercise-data/writing/
24, and every file that ends with ‘.pdb’. On the other hand,$ cd exercise-data/writing/
25 only matches$ cd exercise-data/writing/
26 and$ cd exercise-data/writing/
24, because the ‘p’ at the front only matches filenames that begin with the letter ‘p’.$ cd exercise-data/writing/
28 is also a wildcard, but it matches exactly one character. So$ cd exercise-data/writing/
29 would match$ cd exercise-data/writing/
30 whereas$ cd exercise-data/writing/
31 matches both$ cd exercise-data/writing/
23, and$ cd exercise-data/writing/
30.$ cd exercise-data/writing/
Wildcards can be used in combination with each other e.g.
34 matches three characters followed by$ cd exercise-data/writing/
35, giving$ cd exercise-data/writing/
36.$ cd exercise-data/writing/
When the shell sees a wildcard, it expands the wildcard to create a list of matching filenames before running the command that was asked for. As an exception, if a wildcard expression does not match any file, Bash will pass the expression as an argument to the command as it is. For example, typing
37 in the$ cd exercise-data/writing/
38 directory [which contains only files with names ending with$ cd exercise-data/writing/
39] results in an error message that there is no file called$ cd exercise-data/writing/
40. However, generally commands like$ cd exercise-data/writing/
41 and$ cd exercise-data/writing/
3 see the lists of file names matching these expressions, but not the wildcards themselves. It is the shell, not the other programs, that deals with expanding wildcards.$ ls -F thesis
List filenames matching a pattern
When run in the
38 directory, which$ cd exercise-data/writing/
3 command[s] will produce this output?$ ls -F thesis
45$ cd exercise-data/writing/
46$ cd exercise-data/writing/
47$ cd exercise-data/writing/
48$ cd exercise-data/writing/
49$ cd exercise-data/writing/
Solution
The solution is
50$ cd exercise-data/writing/
51 shows all files whose names contain zero or more characters [$ cd exercise-data/writing/
20] followed by the letter$ cd exercise-data/writing/
53, then zero or more characters [$ cd exercise-data/writing/
20] followed by$ cd exercise-data/writing/
35. This gives$ cd exercise-data/writing/
56.$ cd exercise-data/writing/
57 shows all files whose names start with zero or more characters [$ cd exercise-data/writing/
20] followed by the letter$ cd exercise-data/writing/
53, then a single character [$ cd exercise-data/writing/
28], then$ cd exercise-data/writing/
61 followed by zero or more characters [$ cd exercise-data/writing/
20]. This will give us$ cd exercise-data/writing/
63 and$ cd exercise-data/writing/
26 but doesn’t match anything which ends in$ cd exercise-data/writing/
65.$ cd exercise-data/writing/
50 fixes the problems of option 2 by matching two characters [$ cd exercise-data/writing/
67] between$ cd exercise-data/writing/
53 and$ cd exercise-data/writing/
69. This is the solution.$ cd exercise-data/writing/
70 only shows files starting with$ cd exercise-data/writing/
71.$ cd exercise-data/writing/
More on Wildcards
Sam has a directory containing calibration data, datasets, and descriptions of the datasets:
3$ mkdir thesis
Before heading off to another field trip, she wants to back up her data and send some datasets to her colleague Bob. Sam uses the following commands to get the job done:
4$ mkdir thesis
Help Sam by filling in the blanks.
The resulting directory structure should look like this
5$ mkdir thesis
Solution
6$ mkdir thesis
Organizing Directories and Files
Jamie is working on a project and she sees that her files aren’t very well organized:
$ ls -F
8$ mkdir thesis
The
72 and$ cd exercise-data/writing/
61 files contain output from her data analysis. What command[s] covered in this lesson does she need to run so that the commands below will produce the output shown?/Users/nelle/Desktop/shell-lesson-data
$ ls -F
0$ ls -F
1$ ls -F
2$ ls -F
Solution
3$ ls -F
Jamie needs to move her files
72 and$ cd exercise-data/writing/
61 to the/Users/nelle/Desktop/shell-lesson-data
76 directory. The shell will expand *.dat to match all .dat files in the current directory. The$ cd exercise-data/writing/
39 command then moves the list of .dat files to the ‘analyzed’ directory./Users/nelle/Desktop/shell-lesson-data
Reproduce a folder structure
You’re starting a new experiment and would like to duplicate the directory structure from your previous experiment so you can add new data.
Assume that the previous experiment is in a folder called
78, which contains a$ cd exercise-data/writing/
79 folder that in turn contains folders named$ cd exercise-data/writing/
63 and/Users/nelle/Desktop/shell-lesson-data
81 that contain data files. The goal is to copy the folder structure of the$ cd exercise-data/writing/
78 folder into a folder called$ cd exercise-data/writing/
83 so that your final directory structure looks like this:$ cd exercise-data/writing/
4$ ls -F
Which of the following set of commands would achieve this objective? What would the other commands do?
5$ ls -F
6$ ls -F
7$ ls -F
8$ ls -F
9$ ls -F
Solution
The first two sets of commands achieve this objective. The first set uses relative paths to create the top-level directory before the subdirectories.
The third set of commands will give an error because the default behavior of
5 won’t create a subdirectory of a non-existent directory: the intermediate level folders must be created first.haiku.txt LittleWomen.txt thesis/
The fourth set of commands achieve this objective. Remember, the
0 option, followed by a path of one or more directories, will cause$ ls -F thesis
5 to create any intermediate subdirectories as required.haiku.txt LittleWomen.txt thesis/
The final set of commands generates the ‘raw’ and ‘processed’ directories at the same level as the ‘data’ directory.
Key Points
87 copies a file.$ cd exercise-data/writing/
88 creates a new directory.$ cd exercise-data/writing/
89 moves [renames] a file or directory.$ cd exercise-data/writing/
90 removes [deletes] a file.$ cd exercise-data/writing/
20 matches zero or more characters in a filename, so$ cd exercise-data/writing/
92 matches all files ending in$ cd exercise-data/writing/
29./Users/nelle/Desktop/shell-lesson-data
28 matches any single character in a filename, so$ cd exercise-data/writing/
95 matches$ cd exercise-data/writing/
96 but not$ cd exercise-data/writing/
97.$ cd exercise-data/writing/
Use of the Control key may be described in many ways, including
08,/Users/nelle/Desktop/shell-lesson-data
06, and/Users/nelle/Desktop/shell-lesson-data
10./Users/nelle/Desktop/shell-lesson-data
The shell does not have a trash bin: once something is deleted, it’s really gone.
Most files’ names are
01. The extension isn’t required, and doesn’t guarantee anything, but is normally used to indicate the type of data in the file.$ ls -F
Which of the following shells was the first UNIX command processor?
The first Unix shell was the Thompson shell, sh, written by Ken Thompson at Bell Labs and distributed with Versions 1 through 6 of Unix, from 1971 to 1975.When using WC you Cannot specify all three options in the command line at the same time?
When using wc, you cannot specify all three options [-l, -w and -c] in the command line at the same time. The pipe operator can connect several commands on the same command line.