Linux Fundamentals and Basics Linux command

Linux Fundamentals and Basics Linux command

Linux is an open-source operating system (OS). An operating system is the software that directly manages a system's hardware and resources, like CPU, memory, and storage. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.

Basics Linux command

ls --> The ls command is used to list files or directories in Linux and other Unix-based operating systems.

ls -l--> Type the ls -l command to list the contents of the directory in a table format with columns including.

  • content permissions
  • number of links to the content

  • owner of the content

  • group owner of the content

  • size of the content in bytes

  • last modified date / time of the content

  • file or directory name

ls -a --> Type the ls -a command to list files or directories including hidden files or directories. In Linux, anything that begins with a . is considered a hidden file.

The command "ls *.sh" is a Unix/Linux command that is used to list all files in the current directory with a ".sh" extension.

ls -i --> List the files and directories with index numbers in orders.

ls -d */ --> Type the ls -d */ command to list only directories.

Directory Commands

pwd --> Print work directory. Gives the present working directory.

cd path_to_directory --> Change directory to the provided path.

cd ~ or just cd --> Change directory to the home directory.

cd - --> Go to the last working directory.

cd .. --> Change the directory to one step back.

cd ../.. --> Use ls ../.. for contents two levels above.

mkdir directoryName --> Use to make a directory in a specific location.

mkdir .NewFolder --> Make a hidden directory (also . before a file to make it hidden)

mkdir A B C D --> Make multiple directories at the same time.

mkdir /home/user/Mydirectory --> make a new folder in a specific location

mkdir -p A/B/C/D --> Make a nested directory