❌

Reading view

There are new articles available, click to refresh the page.

Linux Basic Commands II

File Permission Commands:

Chmod - Change file permissions.

  • u: User/owner permissions.
  • g: Group permissions.
  • o: Other permissions.
  • +: Add permissions.
  • –: Remove permissions.
  • =: Set permissions explicitly.

Chown - Change file ownership.

Chgrp - Change group ownership.

File Compression and Archiving Commands:
**
**Tar
- Create or extract archive files.

  • -c: Create a new archive.
  • -x: Extract files from an archive.
  • -f: Specify the archive file name.
  • -v: Verbose mode.
  • -z: Compress the archive with gzip.
  • -j: Compress the archive with bzip2.

Gzip - for Compress files

  • -d: Decompress files.

Zip - to Create compressed zip archives.

  • -r: Recursively include directories.

Basic Linux Commands

  1. pwd β€” When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the β€œpwd” command. It gives us the absolute path, which means the path that starts from the root. The root is the base of the Linux file system and is denoted by a forward slash( / ). The user directory is usually something like β€œ/home/username”.

Image description

  1. ls β€” Use the β€œls” command to know what files are in the directory you are in. You can see all the hidden files by using the command β€œls -a”.

Image description

  1. cd β€” Use the β€œcd” command to go to a directory. β€œcd” expects directory name or path of new directory as input.

Image description

  1. mkdir & rmdir β€” Use the mkdir command when you need to create a folder or a directory.Use rmdir to delete a directory. But rmdir can only be used to delete an empty directory. To delete a directory containing files, use rm.

Image description

  1. rm – Use the rm command to delete a file. Use β€œrm -r” to recursively delete all files within a specific directory.

Image description

  1. touch β€” The touch command is used to create an empty file. For example, β€œtouch new.txt”.

Image description

  1. cp β€” Use the cp command to copy files through the command line.

Image description

  1. mv β€” Use the mv command to move files through the command line. We can also use the mv command to rename a file.

Image description

9.cat β€” Use the cat command to display the contents of a file. It is usually used to easily view programs.

Image description

10.vi - You can create a new file or modify a file using this editor.

Image description

❌