Библиотека сайта или "Мой Linux Documentation Project"
Directories are Folders: Directories are sometimes called folders in other operating systems (such as Microsoft Windows)
mkdir -p /home/matt/work/maths
Remove/delete a file(s) or directories(s). You can use standard wildcards with this command the Section called Standard Wildcards (globbing patterns) in Chapter 20.
rm -options file_or_folder
mv filename1 filename2
mv original_file_or_folder new_location
Note that this command can use standard wildcards the Section called Standard Wildcards (globbing patterns) in Chapter 20 to move files (not for renaming).
Move and rename: Note that you can also move and rename a file in a single command. The difference is with the destination (right hand side) you change the filename to the new name of the file.
For example typing:
mv /etc/configuration.txt /home/joe/backupconfig
This would move the file "configuration.txt" to /home/joe/ and rename it "backupconfig"
cp -options file_or_files new_location
cp file1 file2
cp /tmp/file1 ~/file2 /mnt/win_c
cp -R directory_and_or_files new_location
Note that this command can use standard wildcards the Section called Standard Wildcards (globbing patterns) in Chapter 20 to copy multiple files.
You may also like to try the “-u” when moving large directories around, this copies only if the source file is newer than the destination to where you are copying to, or if the destination file does not exist at all.
- Hard links
ln target_name link_name
- Symbolic links
ln -s target_name link_name
Securely remove a file by overwriting it first. Prevents the data from being recovered by software (and even by most hardware), please be very careful when using shred as you may never be able to retrieve the data you have run the application on.
shred -n 2 -z -v /dev/hda1
“What this tells shred, is to overwrite the partition 2 times with random data (- n 2) then finish it up by writing over it with zeroes (-z) and show you its progress (-v). Of course, change /dev/hda1 to the correct partition . Each pass can take some time, which is why I set it to only do 2 random passes instead of the default 25. You can adjust this number, of course, to your particular level of paranoia and the amount of time you have.
Since shred writes on such a low-level, it doesn't actually matter what kind of filesystem is on the partition--everything will be unrecoverable. Once shred is finished, you can shutdown the machine and sell or throw away the drive with peace of mind.
...However, even shre dding devices is not always completely reliable. For example, most disks map out bad sectors invisibly to the application; if the bad sectors contain sensitive data, `shred' won't be able to destroy it. [ shred info page ].”
Shredding files doesn't work with all filesystems: Please note that as mentioned in the shred manual page (please see the manual and preferably info pages for more information). shred does not work correctly on log-structured or journaled filesystems, such as JFS, ReiserFS, XFS, Ext3 and many other modern filesystems
Alternatives to using shred: shred has its disadvantages when run on a filesystem. First of all since it has to be installed you cannot run shred on your operating systems filesystem, you also cannot use shred on a windows machine easily since you cannot install shred on this machine.
You may like to try alternatives such as the DBAN project that create self-booting floppy disks that can completely erase a machines hard disk.
You may also like to see how chattr can assist you in shredding files once they are removed (it has similar problems to shred, only ext2 and ext3 style filesystems...), please see the Section called File Permissions in Chapter 14.
Displays information about file size. Use du filename to display the size of a particular file. If you use it on directories it will display the information on the size of the files in the directory and each subdirectory.
du -options file_directory_or_files
du -hs *
This command will list the size of all files in the current directory and it will list the size of subdirectories, it will list things in human-readable sizes using 1024 Kb is a Megabyte, M for megabyte, K for kilobyte etc.
Attempts to find out what type of file it is, for example it may say it's: binary, an image file (well it will say jpeg, bmp et cetera), ASCII text, C header file and many other kinds of files, it's a very useful utility.
For simple use type:
Copies data on a very low level and can be used to create copies of disks the Section called Duplicating disks in Chapter 20 and many other things (for example CD image files).
Please note: dd is an advanced and difficult to use command. Its also very powerful, so be careful what you do with it
dd if=/dev/xxx of=/dev/xxx bs=xxxx count=x
The command dd is used to work on a very low level. It can be used to overwrite important information such as your master-boot record or various important sections of your hard-disk. Please be careful when using it (especially when working with devices instead of files).
touch -t 05070915 my_report.txt
This command would change the timestamp on my_report.txt so that it would look like you created it at 9:15. The first four digits stand for May 7th (0507), in MM-DD (American style), and the last four (0915) the time, 9:15 in the morning.
touch -d '5 May 2000' some_file.txt
You can also use --date= instead of -d. Also have a look at the date command under the Section called Date/Time/Calendars in Chapter 8 for examples on using -d and --date= (the syntax for the date part is exactly the same when using -d or --date).
split -options file
This will split the input file into 1000 lines of input each (thats the default...), and output (using the above example), with the input name file, “fileaa” (1st part of file), “fileab” (2nd part of file), “fileac” (3rd part of file) etc. until the there is no more of the file left to split.
This information (as quoted) has come from the “Please, For the Love of All That's Recoverable, Shred Your Hard Drive!” article, number 18 in the Bibliography
This particular command and explanation has been used (with editing) from the Linux Online Classroom, see  in the Bibliography for further information.
Только зарегистрированные пользователи могут оценивать и комментировать статьи.