Things to know about Linux and some basic commands

Things to know about Linux and some basic commands

Linux is a free and open-source operating system (OS) based on the Unix operating system. It was created by Linus Torvalds in 1991 and has since become one of the most widely used operating systems in the world. Linux is known for its stability, flexibility, and security, and it is used in a wide range of devices, from servers and desktop computers to embedded systems and smartphones.

How is the Architecture of Linux ?

  • Hardware :- This is the physical layer of any system,which contains Harddisc,RAM , CPU, Processer and other physical components which needs to run the OS .

  • Kernel :- The Linux kernel is the core part of the operating system that interacts directly with the hardware. It provides device drivers, manages system resources such as CPU, memory, and I/O devices, and implements process scheduling, memory management, and other essential functions. The Linux kernel is modular and can be configured at compile-time or runtime to support different hardware architectures, file systems, and features.

  • Shell :- This is just a medium to communicate between Kernal and the Application layer. Shell takes the input commands from the Application layer and sends them to the kernel for processing.

  • Application:- This is the layer where the user get interacted with the operating system this is the main layer .

Some basics but most used command in Linux.

below are some basic commands which you need every time while interacting with Linux for creating a file and playing with it.

  • ls --> This command is used for listing files or directories in linux and other Unix - based Operating systems.

  • ls -a: lists all files including hidden files (those whose names start with a . dot).

  • ls -l: lists files in long format, including permissions, owner, group, size, date modified, and filename.

  • ls -d : List only directories in the path. type ls -d */ for checking

  • ls -i : list the files and directories with their index numbers .

  • ls -lh: lists files in long format, but with the file sizes listed as "human-readable" (e.g. 1.5M instead of bytes).

  • ls -R: lists all files and directories recursively from the current directory downwards.

  • ls -t: lists files sorted by modification time, from newest to oldest.

  • ls -r: lists files in reverse order.

  • ls -S: lists files sorted by size, from largest to smallest.

  • ls -G: lists files without displaying group information.

    here l has used for list view only .

  • ls -1: similar to the basic ls command, but each file or directory is displayed in a separate line.

Here are some Directory related commands which we use mostly in our day-to-day activity.

  • pwd: shows the current working directory.

  • cd: changes the current directory. For example, cd /path/to/directory moves the current directory to the specified directory. cd -> stands for change directory .now u can see we changed from home to test directory.

  • mkdir: creates a new directory. For example, mkdir new_dir creates a new directory called "new_dir" in the current directory.

  • mkdir .hidden_folder : Make a hidden directories with using dot before file or folder name .

  • rmdir: removes an empty directory. For example, rmdir new_dir removes the "new_dir" directory as long as it is empty.

  • rm -r: removes a directory and its contents. For example, rm -r test removes the "test" directory and any files or directories it contains. after running the rm -r test command u will be no longer to view that directory or files .

  • cp: copies files or directories. For example, cp ./demo1/text1 ./demo2 copies the "text1" file to the specified location ./demo2

  • mv: moves or renames files or directories. For example, here we are simple movie

  • mkdir -p X/Y/Z/U: for creating a nested directory. here -p stands for parent .for example directory X is the parent directory of the directory Y. If the parent directory does not exist -p will create the parent directory.

So , guys these are my knowledge on some basics commands for Linux . please read and give your suggestions for improve my knowledge .

Thank You .