Skip to main content

Learning the concepts of Linux

Linux Workshop Day-2

Published 3 min readMarkdown
Learning the concepts of Linux

Hello everyone, I'm back with a blog on Linux concepts. Today I will be describing the concepts of Linux which we learned during the Linux workshop Day-2.

Remote Copying Tools:

  1. SCP: Secure File Copy is a program for copying files between computers. The SCP command copies files or directories between a local and a remote system or between two remote systems.

    Syntax: scp <filename> <username>@<ipaddress>:<destination>

  2. Rsync: Rsync is an efficient and versatile utility, and is often the preferred choice for file transfers and synchronization tasks. It syncs the devices by transferring incremental data. In rsync two algorithms are used namely, delta transfer and checksome.

    Syntax: rsync -av <filename> <username>@<ipaddress>:<destination>

    -av -> a=archive & v=verbos

  3. SFTP: Secure File Transfer Protocol is used to access, manage and transfer files over an encrypted SSH transport. It allows us to perform a range of operations on remote files and resume file transfers.

    Syntax: sftp <username>@<ipaddress>

Archive and Backup:

Archiving tools:

Archiving is the process of combining multiple files into a single package called an archive. This archive can then be easily distributed to another machine, backed up in a repository somewhere or simply kept on our machine as a way to organize and clean up our file system.

  1. gzip:

    Syntax: gzip <filename> ->It is used to compress the file.

     Example ->  gzip test1
    

    Syntax: gunzip <filename>.gz ->It is used to decompress the file.

     Example ->  gunzip test1.gz
    
  2. xz:

    Syntax: xz <filename> ->It is used to compress the file.

     Example ->  xz test1
    

    Syntax: unxz <filename>.xz ->It is used to decompress the file.

     Example ->  unxz test1.xz
    
  3. bzip2:

    Syntax: bzip2 <filename> ->It is used to compress the file.

     Example ->  bzip2 test1
    

    Syntax: bunzip2 <filename>.bz2 ->It is used to decompress the file.

     Example ->  bunzip2 test1.bz2
    

Backup:

tar: Combines multiple files, compresses and creates a new file.

Syntax: tar -cvzf <newfilename.backup> <file1><file2><file3><file4> -> combines multiple files.

-cvzf -> c=create, v=verbos, z=zip & f=file

Example: tar -cvzf linux.backup file*

Syntax: tar -xvf <newfilename.backup> -> compresses and creates new file.

-xvf -> x=extract, v=verbos & f=file

Example: tar -xvf linux.backup

User Management:

Add user:

Syntax: sudo adduser <username>

Example: sudo adduser testuser

Verify user:

Syntax: id <username>

Example: id testuser

Delete user:

Syntax: userdel <username>

Example: userdel testuser

Manage the password policy:

Syntax: cat /etc/passwd|tail -1

Example: sudo cat /etc/passwd|tail -1

Change/Restrict user

Give 'No Login' command:

Syntax: usermod <username> -s /sbin/nologin

Example: sudo usermod testuser -s /sbin/nologin

Revert the changes to give a login command:

Syntax: usermod <username> -s /bin/sh

Example: sudo usermod testuser -s /bin/sh

Lock and unlock user:

Lock user syntax: usermod -L <username>

Example: sudo usermod -L testuser

Unlock user syntax: usermod -U <username>

Example: sudo usermod -U testuser

Adding group:

Syntax: groupadd <groupname>

Example: sudo groupadd IOPE

Add user to group:

Syntax: usermod -G <groupname>

Example: sudo usermod -G IOPE

Deleting group:

Syntax: groupdel <groupname>

Example: groupdel IOPE

Change id of the user:

Syntax: usermod -u <new_id> <username>

Example: sudo usermod -u richa testuser

These were the concepts covered during our Day-2 Linux Workshop.

Thank You!!!

No comments yet. Be the first to comment.