Here are some common file commands used in Linux:
-
ls: Lists the files and directories in the current directory.ls -
cd: Changes the current directory.cd /path/to/directory -
pwd: Prints the current working directory.pwd -
touch: Creates a new empty file or updates the timestamp of an existing file.touch filename.txt -
cp: Copies files or directories.cp source.txt destination.txt -
mv: Moves or renames files or directories.mv oldname.txt newname.txt -
rm: Removes (deletes) files or directories.rm filename.txt -
mkdir: Creates a new directory.mkdir new_directory -
rmdir: Removes an empty directory.rmdir empty_directory -
cat: Displays the contents of a file.cat filename.txt -
head: Displays the first few lines of a file.head filename.txt -
tail: Displays the last few lines of a file.tail filename.txt -
chmod: Changes the permissions of a file or directory.chmod 755 filename.txt -
chown: Changes the owner of a file or directory.chown user:group filename.txt
These commands are essential for managing files and directories in a Linux environment.
