Explorer program.
Conductor- a utility program designed to navigate the file structure of a computer and maintain it. Explorer is very deeply integrated into operating system Windows. In fact, we work with it even when we do not see it. If by right-clicking on any object we get a context menu, this is the result of the invisible work of Explorer. If, when dragging objects from one window to another, they are copied or moved, this is also the result of Explorer's extramural activity. However, it is false to work with him “in person”. The program is launched with the Start command → Programs → Conductor.
In terms of controls, this window is very similar to folder windows. The main difference is that the Explorer window has two workspaces instead of one: the left pane, called the folder pane, and the right pane, called the content pane.
Navigating through the file structure.
The purpose of navigation is to provide access to the desired folder and its contents.
The file structure is navigated in the left pane of Explorer, which shows the folder structure. Folders can be expanded or collapsed, as well as expanded or closed. If a folder has subfolders, a node marked with a "+" is displayed next to the folder in the left pane. Clicking on a node expands the folder, and the node's icon changes to "-". In the same way, folders are collapsed.
To open a folder, click on its icon. The contents of the expanded folder are displayed in the right pane. One of the folders in the left pane is always open. It is not possible to close a folder by clicking on its icon - it will close automatically when opening any other folder.
Launching programs and opening documents.
This operation is performed by double-clicking the program or document icon in the right pane of Explorer. If the desired item is not shown in the right pane, you must navigate in the left pane and find the folder where it is located.
Create folders. To create a new folder, first open the folder in which it will be created in the left pane of Explorer. After that, you need to go to the right panel, right-click on a place free from icons and select Create from the context menu → folder. A folder icon will appear in the right pane with the name new folder. Once the title is selected, it can be edited. When the folder is created, it will be part of the file structure displayed in the left pane.
Copying and moving files and folders. The folder from which the copy is made is called the source. The folder to which the copy is made is called the destination. Copying is performed by the method drag and drop object icon from the right pane of Explorer to the left pane.
The first task is to find and expand the source folder so that the copied object is visible in the right panel. The second task is to find the destination folder on the left panel, but you do not need to open it. Next, the object is dragged from the right panel to the left and placed on the destination folder icon.
If both the source folder and the destination folder belong to the same drive, then dragging is performed moving, and if different, then copying. In cases where the reverse action is needed, perform special drag and drop with the right mouse button pressed.
Deleting files and folders. Work begins with navigation. On the left panel, open the folder containing the object to be deleted, and on the right panel, select the desired object (or group of objects).
Removal can be done in several ways:
using the command File → Delete from the menu bar (if no object is selected, this command is not activated);
use the command button on the toolbar;
using the context menu (right-click on the object to be deleted and select the item from the context menu Delete};
use the I>Delete> key of the keyboard.
Clipboard.
In the system Windows environment data can be exchanged via window system or through the program Conductor, using basic mouse control techniques - drag and drop, special drag and drop, as well as through system-wide techniques that use the clipboard to work with objects. These techniques work for all Windows applications. Through the clipboard, you can transfer text fragments from one document to another, you can transfer illustrations, sound recordings, video clips, files, folders.
Clipboard- a special area of memory that is intended for temporary storage of a transferred, copied or deleted object.
Principles of working with the clipboard.
1. Open the source folder (from where). Select the desired object by clicking the left button.
2. Copy or take (cut) the object to the clipboard. In the first case, the object remains in the source folder and can be reproduced. In the second case, it is removed from the source folder, but may be stored in the buffer for some time.
3. Open the destination folder (where) and place the object from the clipboard into it.
These operations (Copy, Cut, Paste) can be performed in different ways:
using paragraph Edit in the menu bar;
using command buttons on the toolbar;
using the context menu of objects;
using certain keyboard shortcuts (- copy to clipboard, - cut to clipboard, - paste from clipboard).
Wrappers
shell program- this is a program that facilitates the user's communication with the computer and provides him with a number of additional universal features. Far, Windows Commander are modern shell programs.
Far is a text-mode file manager for Windows 95/98/NT with support for long filenames and a wide range of file and folder operations. Far allows you to work with archives, while files in archives are processed similarly to files in folders. When Far is launched, two blue panels are displayed on the screen, each of which can display the contents of the file, information, folder tree, and quick view panels.
The bottom line of the panel displays information about the selected file or group of files.
The bottom line of the screen lists the commands that are executed when the function keys are pressed. Above the function key line is the command line - a place to enter DOS commands and issue messages. The command line shows the current drive and current folder. Exit from the program - key F10.
WindowsCommander is a program with a graphical intuitive interface, in the window of which there are two windows for displaying information on disks. The Windows Commander program organically combined the main functionality of programs similar to Far, Explorer, WinRar. The function of connecting to Internet files via FTP protocol has been added, it is possible to view a file (F3) of any size in hexadecimal, binary or text format, line width and font size can now be changed (replaced). There is a keypad and main menu configurable to run external programs or internal menu commands. Today it is the best shell program.
How to work with Far
To display the contents of a folder on the current panel (open a folder), you need to select this folder with the cursor and press the key.
Switching to the directory one level higher - select the line "..." with the cursor in the panel and press the key.
Transition from panel to panel - press the key or click the left mouse button in the window of the desired panel.
Installing the desired disk - press the keys for the left panel and - for the right. Next, from the list of disks, select the desired disk with the cursor or the left mouse button, press the key.
Highlight files or folders - press the key
Frequent operations in the file structure are the creation of files and directories, their copying, moving, renaming, and deletion. Obviously, special commands must be provided in the Linux shell for such actions.
Copying files and directories
Bash uses the command to copy files cp(from "copy"), which usually takes two arguments:
address with the name of the source file,
a new address with a name, or just the address of the directory where the copy is placed.
The address can be either absolute or relative. If file operations are performed in the current directory, then there is no point in specifying the address. Only the name of the original file and the name of the copy are written. Since there cannot be files with the same name and address, the name of the copy must be different from the name of the original file.
Consider examples.
cp readme readme2
In this case, a copy of the readme file is created and remains in the same directory as readme2.
cp readme Desktop/
The readme file is copied to the Desktop folder. Here, the current directory is the parent Desktop "y directory. The names of the copy and the original file will match, but the full addresses will not.
cp / home/ irina/ tux.png / mnt/ D/ pingvin.png
Here the file is copied from one directory to another, absolute addresses are used, the name of the copy is changed.
If you need to copy several different files to the same directory, then after the cd command, all the original files are listed first, and the directory where the copies are placed is indicated last. It is clear that with such a group action, file names cannot be changed.
To copy a directory with all its contents, you must use the -r switch of the cp command:
cp -r ./ letters ./ oldletters
Move and rename
In the Linux Bash shell, the same command is used to move and rename − mv(from "move" - to move). Renaming can be thought of as a special case of moving, because in fact the full address of the file is changed, which is tantamount to moving, even if the file remains in the same directory.
Just like cp, mv requires a couple of arguments. The choice between move and rename depends on what those arguments are. When moving, the file changes its address, therefore, if different addresses are specified in the first and second arguments, then the move will occur. If the addresses are the same, but only the names differ, the renaming occurs. In addition, moving can be combined with renaming.
In the case of a move without a rename, only the destination directory is specified in the second argument.
mv document.txt Work
mv document.txt Work/ doc23.txt
Here, in the first case, the document.txt file is moved to the Work directory. In the second case, the file is moved and renamed at the same time: the document.txt file is moved to the Work directory and gets a new name doc23.txt.
When using the mv command to rename, the new name is given as the second argument:
mv order.txt orderNew.txt
mv Work/ list.odt Work/names.odt
Directories are moved and renamed in the same way as files. Bulk moving files works the same way as with the cp command.
Creating files and directories
New directories are created by the command mkdir. For example, to create the Work directory in the current directory, you would run the following command:
mkdir Work
or
mkdir ./Work
There are many ways to create files, usually they are created by some program. If you still need to create an empty file, you can do this using the touch program. It is passed the name of the file to be created as an argument. Another way is . Example:
cal > ./ Work/ January
Here the cal program outputs the calendar for the current month, and since there is an output redirection sign, the output of the command will be written to the file January, located in the Work folder.
Anyone with at least a little experience in DOS or a DOS box Windows systems, knows that dragging files from window to window is not the only way to copy them. The DOS copy command provides additional features - such as the use of wildcards - that can make the process faster, easier, and more efficient than File Manager or Explorer.
Linux uses the cp (/bin/cp) command to copy.
Basic copy operations
Of course, the simplest use of the cp command is to copy a file from one directory to another, or to create a duplicate in the same directory. For example, to create a copy of the file ThisFile by placing it in the same directory as ThisFile-Acopy, you would type the following command:
$ cf ThisFile ThisFile-Acopy
If we now look into the specified directory using the 1s -1 command, then it will contain two files of exactly the same size, but with different creation dates. The date of creation of the new file will coincide with the date of copying, the original one will remain unchanged. Changing the ThisFile-Acopy file will not affect the ThisFile.
Similarly, you can copy the ThisFile file to the /tmp directory (for example, to share it with another user). To do this, use the following command.
$ cf ThisFile /tmp
If the file being copied to another directory also needs to be renamed, enter the command:
$ cf ThisFile /tmp/NewFileName
Do not overwrite an existing file
All Linux distributions have one major drawback: when copying files, there is a danger of overwriting the copy over an existing file. Suppose you have two files, ThisF%le and NewFile. If you decide to create a copy of one of them by issuing the command
$ cf ThisFile NewFile
the copy will overwrite the NewFile, causing it to be lost (unless, of course, you were smart enough to take care of the backup).
To avoid trouble, enter the cp command with the -i flag. In this case, the system will require confirmation of copying over the existing file.
$ cf -i ThisFile NewFile
cf: overwrite "ThisFile"?
To protect yourself from such troubles, create an alias (pseudo name) for the cp command with the following command:
$ alias cp="cp -i
Now, each time the cp command is called, the latter will automatically turn into the cp -i command. Therefore, a warning will be issued about every instance of copying over an existing file. As shown in ch. 16 by modifying the file. bashrc can be used to configure the Bash shell so that the specified alias is set on every login. (Shell is a program that manages the command line environment)
It is very important that when logging in with the superuser account (aka root user), the specified alias is automatically set, since the slightest mistake by the superuser can have disastrous consequences.
Copying multiple files with one command
One of the disadvantages of the DOS copy command is that you can only specify one filename or expression in it. For example, on command
$ copy file /temp
the file file is copied to the /temp directory. Another option: $ copy *.tsct /temp
In this case, all text files from the current directory are copied to the /temp directory. If you need to copy three separate files, you will have to enter the command three times. To copy all text and executable (. exe) files in the current directory, the command will have to be entered twice.
The Linux cp command is somewhat more convenient in this regard. Unlike the DOS counterpart, the cp command can take more than two arguments. In this case, the last of them is treated as the destination address, the rest - as the names of the copied files.
Consider an example. Suppose we want to copy files FileOne, FileTwo and FileThree from the current directory to the /trap directory. Naturally, this can be done by entering the copy command three times.
$ cf FileOne /tmp
$ cf FileTwo /tmp
$ cf FileThree /tmp
You can simplify the task by combining three commands into one. $ cf FileOne FileTwo FileThree /tmp
Similarly, when copying a large number of files, you can specify multiple wildcard arguments.
$ cf *.txt *.doc *.bak /tmp
In this case, all files whose names have one of the three specified extensions are copied.
Note
Remember: when copying multiple files this way, the last argument must be a directory, because you can't copy multiple files into one. Violation of this condition results in the following error message:
cf: when copying multiple files, last argument must be a directory. Try "cp -help" for more information. (When copying multiple files, the directory must be listed last. For more information, type "cp --help".)
To copy an entire directory with all subdirectories, enter the cp command with the -R flag. If there is a subdirectory SomeDir in the current directory, then to recursively copy this subdirectory (with all its contents) to the /tmp subdirectory, use the following command.
$ sr -R SomeDir /tmp
When copying, a new directory /tmp/SomeDir will be created, into which the contents of the original SomeDir subdirectory will be copied.
Additional features
The cp command provides several additional facilities that enhance the ability to simply copy files and directories. Among them are saving the state of the original file in a copy and alternative methods of copy protection over an existing file.
Ensuring the identity of the copy and the original
Having carefully looked at the created copies, it is easy to see that some of their characteristics have little in common with those of the originals. Among these characteristics are the owner of the file, access permissions, date, and symbolic links. Let's consider each of them in detail.
The owner of a copy of a file is usually the user who made the copy, not the creator of the original file. Suppose the file TheFile was created by userl and placed in the /tmp directory so that user2 can copy it from there to his home directory. In the list of files, this file looks something like this:
After the user2 copy this file with the command
$ cf /tmp/TheFile -/NewFile
it becomes the owner of the copy file.
A file created in a directory is assigned a default permission set. But its copy does not inherit these permissions, but the permissions assigned to the directory it was copied to. Notice the difference in permissions between the original file and the copy in the example above. If the original is set to read-only by user groups, the copy is writable. The date has also changed. In a copy, it coincides with the time of copying, but with the date of the original.
Sometimes it is necessary to keep all the attributes of the original file in the copy. Suppose the root user is backing up a set of files to a removable drive. Unlike regular archiving to tape, which requires other means, in this case you can use the cp command. But backups must fully match the originals. It's time to remember the -p flag, setting which allows you to save all the attributes of the original in the copy. If, returning to the previous example, to run the command
$ cp -p /tmp/TheFile
copy will be indistinguishable from the original:
Another problem with copying files is copying symbolic links. As discussed in the previous chapter, a symbolic link is a pointer to a file in another directory. With the help of logical links, a situation is created in which the file is located, as it were, in several places at the same time. When a link is accessed, it actually accesses the file it points to.
then the result of typing the command
$ cf /tmp/TheFile -/NewFile
would be the following:
The cp command has a flag for this. Checkbox-d disables the dereferencing of the link. The copy command takes the form:
S cf -d /tmp/TheFile -/NewFile
Let's try to summarize what has been said. How can I back up an existing directory with all subdirectories with the cp command? This can be done using a combination of the two flags discussed and recursive copying. For example, on command
$ cp -pdR TheDirectory /backups
an exact copy of the TheDirectory directory is created in the /backups /TheDirectory directory.
$ cf -a. TheDirectory /backups
Error prevention
We've looked at one method of preventing errors - using the -i flag, set directories. There are other methods of setting different degrees of protection.
One is to set the -b flag to back up the files and directories that are being copied over. By default, the backup is given the name of the original file with a tilde (~) appended to the end. Thus, if we use the command
$ cf -b FileOne FileTwo
To copy a FileOne file to an existing FileTwo file, a backup copy of the latter named FileTwo-.
The naming rule for backups can be changed by setting the -S or flag. The -S flag replaces the tilde at the end of the backup name with another character. For example, on command
$ sr -b -S _ FileOne FileTwo
the FileTwo file backup will be named FileTwo_.
The checkbox - backup allows you to select one of three possible schemes naming.
- t or numbered. Sequential numbering of backups: when copying multiple times, their sequence is formed in the form FileName . ~1~, FileName . ~2~ etc.
- nil or existing. If a sequentially numbered backup already exists, the next one is the same, otherwise a normal backup is created.
- never or simple. Create a regular backup with a tilde in the name or another character specified by the -S flag.
For example, in order to create a numbered backup in the considered example, you must enter the command
$ cp - backup= t FileOne FileTwo or
$ cp -backup=numbered FileOne FileTwo
Similarly, by entering the command
$ cp -backup=never FileOne FileTwo and
$ cf --backup=simple FileOne FileTwo
regular backups are created.
The -b flag in Red Hat Linux 7.1 does not work with these options.
Note
In Red Hat Linux 7.1, you can still use the -v flag to control the naming scheme. However, this flag will no longer be available in future versions of cp.
Alternative flag shapes
You've probably noticed the variety of flags for the cp command, which is easy to get confused about. Fortunately, each checkbox has a long but easy to remember form.
COPY Command when running on the command line, allows you to copy one or more files. The command has the syntax: COPYsource[+ source [+ ...]][result ]. The source is the name of the file being copied, and the result is the directory where the copy of that file will be placed and/or the name of the file to be created.
For example, let's create some file on drive "C" (I created a text file "robot.txt"), and on drive "D" some folder (I created folder "folder1"). Then the command to copy the file "robot.txt" to the folder "folder1" looks like this: copy robot.txt d:\folder1
If you want to copy a file, while changing its name, you must write the following command: copy robot.txt d:\folder1\file.txt In this case, the file "robot.txt" will be copied to the folder "folder1", but with the name "file.txt".
In order to copy all files with the selected extension, you need to put an asterisk "*" instead of the file name. For example, let's create a folder on the C drive (I created the papka folder) and copy all the text files from the folder1 folder located on the D drive into it. The command will look like: copy d:\folder1\*.txt c:\folder
If no directory is specified as [result], the copy command will copy the file(s) and place them in the current directory. In this case, the copied files will have the same name, date and time of creation as the original file. For example, let's create a text file with the name "robot1.txt" in the "folder1" folder located on the "D" drive. After that, in the command line, change the current directory from "C:\>" to "C:\Papka". Then the command copy d:\folder1\robot1.txt will copy the file "robot1.txt" from the folder "folder1" and place it in the current directory, i.e. to the "papka" folder located on the "C" drive. Moreover, the name, date and time of creation of the copied file will be identical to the original file.
In order to copy all files from a certain directory, you need to put an asterisk "*" instead of the file name and put an asterisk "*" instead of the file extension. For example, let's create several files in the folder "folder1" with different extensions ( word document, Rar archive, etc.). Then the command to copy all the files from folder "folder1" to drive "C" will look like: copy d:\folder1\*.* c:\
The [source] or [result] of copying can be not only files, but also various devices computer. The following device names are supported on Windows:
- LPT1 - LPT3 (parallel ports).
- COM1 - COM3 (serial ports).
- CON (terminal, output is the computer screen, input is the keyboard).
- PRN (printer).
- AUX (device connected to serial port 1).
For example, using command line and "copy" command, you can create a text file and write information to it: copy con f1.txt . The copy con f1.txt command will create a text file "f1.txt" and copy the characters that you will enter from the keyboard into it.
After entering the copy con f1.txt command, press Enter and enter the words that need to be saved (I entered command com). After entering, you must put an end-of-file sign (press Ctrl + Z).
With the copy command, you can merge multiple files into one file. For example, let's create two files f2.txt and f3.txt on the C drive (we created the f1.txt file earlier) and write some information to these files. Then the command copy f1.txt+f2.txt+f3.txt d:\f4.txt will copy the contents of the files "f1.txt", "f2.txt", "f3.txt" to the file "f4.txt", which will be automatically created on the "D" drive.
If you do not specify file - [result] when merging files, then all information will be saved in the first file. For example, the command copy f1.txt+f2.txt+f3.txt will add the contents of f2.txt and f3.txt to the contents of file f1.txt
Key /Y disables the output of the file replacement message. By default, when copying files, if such a file exists, a message is displayed warning about the replacement. The user can agree to the replacement (press Y) or disagree (press N). The /Y switch disables this message and copying occurs immediately. For example, let's create a vov.txt file on drive C and copy it to drive D: copy vov.txt d:\
Then copy this file again. This displays the message "Replace d:\vov.txt )