bash:commands:file_commands
BASH - Commands - File Commands
File and Disk
Description | Command |
---|---|
Change permission of a file | chmod 666 filename |
Copy file1 to file2 | cp file1 file2 |
Copy directory1 to directory2, create directory2 if it does not exist | cp -r dirname1 dirname2 |
Create a directory | mkdir dirname |
Create a symbolic link to a filename | ln -s /path/to/filename linkname |
Create or update a file | touch filename |
Decrypt file | gpg filename.gpg |
Delete a directory recursively | rm -r dirname |
Delete a directory recursively forcefully | rm -rf dirname |
Delete a file | rm filename |
Delete a file forcefully | rm -f filename |
Display all information on files and directories | ls -a |
Display path of current directory | pwd |
Encrypt file | gpg -c filename |
Execute command lines from standard input | xargs |
Output contents of file | more file |
Output contents of file as it grows starting with last 10 lines | tail -f filename |
Output first 10 lines of file | head file |
Output last 10 lines of file | tail file |
Place standard input into a file | cat > filename |
Print the number of chars, words and lines in a file | wc filename |
bash/commands/file_commands.txt · Last modified: 2021/01/26 15:37 by peter