Skip to main content

Command Palette

Search for a command to run...

./ Week_01_LINUX

Updated
•3 min read•View as Markdown
./ Week_01_LINUX
G

./Living my tale | Support desk agent by night, Student by day | Making magic happen ✨

I don’t like to talk much; let’s cut to the chase.” Sometimes brevity is the best policy, right?

Here's what I learned in week one. #Not so brief, point by point.

  • WHY LINUX

    • Free & Open source

    • Access to Source code

    • Multiple distributions available

    • Security and better malware protection

  • What is Kernel?

    The kernel is a part of an OS that handles communication between hardware and software.

  • What is Shell?

    Shell is a command line interpreter which translates commands entered by the user to a language understood by the kernel.

  • What is Shell script?

    Shell scripts are the list of commands that are listed in order to execute.

  • Most basic Shells

  • C Shell

    • Ideal for learners comfortable with C language.

    • Network admins use

  • Korn Shell (KSH)

    The interactive shell can be used for automation of many computer maintenance and system administration task.

  • Bourne-again Shell (Bash)

    Easy to learn and most commonly used.


    & let's categorize some essential Linux commands:

    User & Groups

    • sudo useradd - creates a user

    • sudo passwd - provides a password to user

    • sudo userdel - deletes the user

    • sudo groupadd - creates a group

    • sudo groupdel - deletes a group

File Viewing and Editing

  • touch - creates a file

  • cat - displays the file content in terminal

    • cat -b : gives numbers to each non-blank line

    • cat -n : gives numbers to all the lines

    • cat -S : squeez the blank lines to one blank line

    • cat -e : provide dollar to the end of each line

  • cp - copies the file or directory

    • cp -n : do not overwrite an existing file

    • cp- u : updates the destination file

    • cp - r : copy directories recursively, even copies the hidden file

  • mv - moves the file or directory

    • mv -i : prompt before overwrite

    • mv -v : explain what is being done

  • rm - removes or deletes file or directory

    • rm -r : remove directories and their contents recursively
  • mkdir - creates a directory

    • mkdir -p : make parent directories as needed
  • rmdir - remove's directory

    • rmdir -p : removes bot parent and sub directories

    • rmdir -pv : removes as above with verbose

  • grep - works as ‘find’ in terminal

  • sort - sort content alphabetically

    • sort -r : returns in reverse order

    • sort -f : case insensetive

    • sort -n : sort in numerical order

Permissions

  • chown - to change the ownership of a file or directory

  • chmod - to change the permissions for file or directory.

  • lsof - list all the open files

    • lsof - u user : all open files by a specific user
  • id - used to find out user name real user id u id group associated with the user and security context to the user

    • id -g : prints only effective group ids

    • id -G : prints all the group ids

    • id -n : prints name instead of numbers

    • id -r : prints real ids instead of numbers

  • tar - used to zip and unzip files of the .tar format

    • tar -cvf filename source foldername : Zip file

    • tar -xvf tarfile : Unzip file

  • cut - used extract and display selected content

    • cut -c(column no.) file :
  • sed - text editor editing operation in non-interactive way (many manipulation possible)

    • sed ‘s/baban /chagan /’ file name: replaces the word with a new word
  • uniq - filters out all the duplicate lines in a file.

  • history - shows the history of whole commands used

    • history (last number of commands used): will show the last number of commands used.

Resources: Linux Tutorial For Beginners | Edureka | https://www.youtube.com/watch?v=Wgi-OfbP2Gw

Will learn the other commands in the following week (there are lots to learn🧐).

./See you next week…