Linux Files
File Commands
Here are some of the common commands to work with files.
- cp filename1 filename2
- cp filename1 filename2 filename2 (etc) directory
- Copies a file, from filename1 to filename2 or (second form) copies one or more files into the specified directory. Warning: if the destination file already exists, it will be overwritten.
- mv filename1 filename2
- Renames a file, from filename1 to filename2. Warning: if the second file already exists, it will be overwritten.
- mv filename1 filename2 filename2 (etc) directory
- Moves one or more files into the specified directory. Warning: if the directory already contains files with the same names, they will be overwritten.
- less filename
- Displays the contents of the specified file onto the screen, allowing you to use the arrow keys, PgUp/PgDown etc to move around (like the "man" command).
- file filename
- Displays the file-type by examining its contents, with a very high degree of accuracy.
- locate file-or-directory-name
- searches for a file or directory in the entire hard disk and displays all the places it’s found. You can also specify a partial name or a section of the entire path.