Kuberty.io
  • blog
Kuberty.io

Linux

Home / Linux
11May

What is Linux Used For? How Does Linux Work?

May 11, 2022 admin Linux

Linux is an open-source operating system that can manage the software and hardware resources of a computer on its own. The computer’s hardware includes CPU, storage, and memory, but Linux bridges the gap between these hardware components and the software. When it comes to physical systems, however, all operating systems work the same way. So what makes Linux different from the others? How does it work?

How is Linux Different from Others?

Because Linux comes with a GUI or graphical user interface, it is similar to other operating systems such as Windows, Mac, iOS, etc. You can use the same software on Linux as on all those other operating systems. This includes video editors, photo editors, text readers, etc. But Linux differs from other OSs in many ways as well, and the first difference is its open-source nature. The code used in Linux is free and open in nature, meaning that other Linux users with coding knowledge can view or edit the source code.

Thus, Linux is fully customizable to suit the needs of different users. Windows and Mac OS distributions cannot be made, but Linux has many distributions like Ubuntu. Linux users can customize the code and create their preferred distro to make it a different type of desktop interface. The open-source nature of Linux is pretty much the reason people use it.

Who Uses Linux?

Linux is not only related to computers but web pages as well because many companies use Linux servers to create web pages. Organizations choose Linux servers because Linux is secure and flexible, and it also has a large community that provides excellent support to the users. Businesses like Red Hat, SUSE, Canonical, etc., use Linux for different purposes.

What are the Use Cases of the Linux Operating System?

You can install devices on various devices, including the following ones.

Smart Devices

There are so many smart devices, and everyone has used at least one in their lifetime. Smart devices include smartphones, tablets, etc. that are essentials to keep a smooth communication between our friends and family. Linux distros are flexible and secure and help your devices to install various software packages so that you can use the benefits of technology right at your fingertips.

Gaming Devices

Gaming is a non-stop, unlimited industry. Numerous video games are available in the market already, and there are more on the way. Therefore, along with the market, the demand for gamers has also changed. Gamers require improved and more advanced devices to continue their gaming entertainment. Linux is one of the highest-ranked operating systems that provide great gaming performance on gaming devices.

Web Servers and Mainframes

Linux is also commonly used on mainframes and web servers. Servers are quite complicated, especially for people with no knowledge regarding web servers and Linux distributions. However, Linux makes building web servers less complicated and time-consuming. A maximum level of security ensures that malicious people or bots won’t get into the server and destroy the privacy and confidentiality of an organization’s data.

Telecommunication

It is very easy to customize Linux, and most of the hardware components required by a network are installed with Linux, which improves telecommunication between the client and traffic. Firewalls protect your network’s information from third parties or unauthorized users, for example. Nevertheless, communication between two devices or between a user and a device will still be safe on the network.

Security

Devices that are equipped with Linux operating systems often come with digital security measures such as forensics, screening identification, guarantee security, ethical hacking, and more privacy features. All of these combined make Linux computers a better place and safe system for users. If someone tries to get into your Linux server, you will receive real-time notification of the threat so that you get the chance to eliminate it by yourself.

The use scenarios or Linux distributions are not new. In fact, it is one of the first open-source operating systems that came into the world for use on devices. And over the decades, it has developed into the most efficient OS.

What is the History of Linux?

In 1991, a student of the University of Helsinki named Linus Torvalds created Linux and made it a free, open-sourced, and a safe alternative to Minix. Minix is an Unix clone but Linux is somewhat different from it. First, Linux was called Freax but he changed the name to “Linux” with a mixture of his first name and the word “Unix” to make it more remarkable.

What is the Difference Between Linux and Unix?

Ken Thompson, Dennis Ritchie, and others at Bell Labs developed Unix years before Linux. In addition to their names, Unix and Linux have some similarities as well. Linux and Unix use the same programming tools, file system layouts, and other features, but not all Unix distributions are free or open-source. There are many operating systems like Unix, however, Linux has had the most success.

Initially, it was a Unix-like operating system, but after years, it was adapted to further smart devices like mobile phones and high-tech computers. There is a Linux kernel in every Linux OS, and it helps in managing hardware resources with a set of software packages that make the total OS. GNU tools are also available for managing the kernel’s resources, configuring the performance and settings of the computer, and installing additional software packages if required. The services provided by Linux OS make it an open-source, secure OS. Since Linux is an open-sourced system, their software combinations can be different from one distro to another.

Note:

There is a command line interface on Linux like other operating systems and it allows you to make changes to the computer freely. For example, you can use one command from the command line tools, and your computer or Linux OS will perform the work for you. The command line can perform actions that your graphical user interfaces (GUIs) cannot and it is the easiest way to tell the hardware what to do on your computer. Despite being available in other OSes, command line works with open-sourced software to make it easier for a user to customize a computer.

Conclusion

With Linux, you can perform all the tasks we’ve discussed here since the distribution comes with many parts that work. Kernel, for example, is the component of the Linux operating system that manages the resources and allows your OS to communicate with the hardware. Additionally, the system user space is crucial for installing software, configuring settings, using command line or PowerShell, and more. Furthermore, Linux applications enable you to maximize your computer’s potential. You can use the pre-downloaded apps on Linux or download more for use.

That’s pretty much how you use Linux and how it works. If you need more information, simply ask us in the comment box below or find out our other articles.

Read more
29Apr

How to Delete Line in Vim on Linux?

April 29, 2022 admin Linux

Vim, earlier called Vi, stands for “Vi IMproved”, is a multi-talented content editor that is viable with all UNIX-based operating systems like Linux and macOS. Vim can be utilized for different purposes, for example, making, or altering text, and additionally, PC program records.

You frequently need to delete/erase at least one line while altering text records in Vim proof-reader. Unlike another similar kind of word processor, Vim permits you to change your documents proficiently. This blog post will help you delete a single line, all lines, multiple lines, a range of lines, lines in a pattern, and much more using the most proficient method in the Vim editor.

You can find various methods to erase lines in Vim. This famous Linux content editor permits you to eliminate multiple or determined examples from a record utilizing a single command. In this post, you will learn to erase lines in Vim using various commands.

In case you don’t have a Vim editor, spare time to install one.

Let’s have a look at some essential ways to delete lines in the Vim editor on Linux.

  1. How to Use Vim Editor to Delete a single line.
  2. How to use Vim Editor to Delete all lines.
  3. How to use Vim Editor to Delete multiple lines.
  4. How to use Vim Editor to Delete a range of lines.
  5. How to Use Vim Editor to Delete lines by a given pattern.

How to Use Vim Editor to Delete a Single Line

Vim Editor is a beautiful text editor that helps professionals to delete or edit a file on Linux. If you want to delete a single line in a file, follow the command mentioned below:

Before moving on to the command to delete a line, we would like to mention the two modes in vim — Command Mode and Insert mode.

When you are working in the command mode, you can edit the file, delete the text, etc.

In the insert mode, as the name suggests, you can insert text as well.

If you want to switch from command mode to insert mode, you need to type the command “a/A/i/I/o/O”

To switch from insert mode to command mode, you need to press the Esc key.

Now to delete a single line in a file, use the command “dd” or “:d”. Here are the steps to delete a single line.

  • To switch to normal mode you have to press the Esc key.
  • Further, bring your cursor to the specific line that you need to erase or delete from your file.
  • Type the command “dd” or “: d” and press the Enter key to remove the line from the file.
  • If you want to delete multiple lines from the file, continue pressing the command “dd” or “: d”.

How to Use Vim Editor to Delete All Lines

When you want to delete all lines, you can either use the command % representing all lines or use 1,$d to describe the range of lines (starting from the first line to the last) you wish to delete. To erase all lines from the file, follow these simple steps:

  • Press the Esc key and switch to the normal mode.
  • Further, to all the lines at once type and enter the following command “:%d”, and press “Enter”.
  • Entering this command will help you to delete all lines from the file.

After finishing the process to delete the lines from files, the VIM Editor will notify you with a notification of no lines available. For example, you have some lines already written in your file and your file has lines 1 to 5. To delete all lines from the file, you will use the command “: %d” and the editor will erase all lines for you.

There is another way to delete all lines from the file. You can use the command “:1, $d”. This command tells the editor to delete all lines starting from the first line to the end of the file.

How to Use Vim Editor to Delete Multiple Lines

Now that we have learned to delete one line and all lines in a file, we will delete multiple lines in a file.

How is this different from deleting all lines? While using the command to delete all lines, we are deleting all lines from the file, but when we use the command to delete multiple lines from the file, we aren’t removing all lines but a few. Let’s see how to remove multiple lines that are consecutive to each other. Make sure, you use this command to delete lines that are following each other. Follow the below-mentioned steps to delete multiple lines:

  • Press the Esc key and switch to the normal mode.
  • Then move your cursor to the first line from where you want to start deleting.
  • Using command “dd”, mention the number of lines that you want to delete. Taking an example of a file that has multiple lines. To delete the specific line you can use the command “dd” and mention the line that you want to delete, in case you don’t want to delete a single line or all lines. For instance, if you want to delete 5 lines from a file, use the command “5dd”.

How to Use Vim Editor to Delete a Range of Lines

Now that you have mastered deleting a line, all lines, multiple lines, let’s see how a user can delete a range of lines. By range, we mean a particular starting and finishing point.

The command to delete a range of lines using Vim Editor is:

:[start from line],[end on this line]d

Let’s take an example to make it more simple: If you want to delete a range of lines starting line 2 and until line 5, you need to follow the below-mentioned steps:

  • Press the Esc key and switch to the normal mode.
  • The next step is to write the command: 2,5d and press the Enter key to delete the particular range of lines 2,3,4, and 5.

Some characters can be used to clarify the range of lines.

You can use

. (dot) – to represent the current line.

$ – to represent the last line.

% – to represent All lines.

Some examples to make it clear:

:.,$d – means continue deleting the current line until the end of the file.

:.,1d – means continue deleting the current line to the start of the file.

10,$d – means continue deleting from the 10th line to the end of the file.

How to Use Vim Editor to Delete Lines by a Given Pattern

Apart from all other features, the Vim editor is also capable of deleting lines in a pattern. If you want to delete lines containing a particular word, for example, “Star”, you can do that using this feature. Here are simple steps to delete lines containing the expression “Star”:

  • Press the Esc key and switch to the normal mode.
  • The next step is to write “:g /word that you want to highlight (in this case it will be Star)/d”, then press “Enter”.

This command will delete all lines that contain the word “Star”.

You can also use this feature to delete all lines not containing any particular word or pattern. For example, if you want to delete all lines that do not have the word “Star”, you can follow the below-mentioned steps:

  • Press the Esc key and switch to the normal mode.
  • The next step is to write “:g! /word that you want to highlight (in this case it will be Linux)/d”, then press “Enter”. (Note that the user needs to add a “!” after the command “:g” to clarify that he or she wants to remove all lines except the lines containing the word or pattern following it.)

This command will delete all lines that do not contain the word “Star”.

Conclusion

It can be difficult for beginners to get started with Vim, so we did some research work and came up with this post to make things easier for them. A lot of time, people need a reference to begin their task. For all engineers and content editors looking for a magical Text Editor on Linux, Vim can be a blessing.

For Linux clients and engineers, Vim editor is considered the most preferable editor. It’s a free, much-reported, and adaptable word processor. In this post, we figured out how to delete a single line, multiple lines, all lines, a range of lines, and lines containing (not containing) specific patterns in Vim. Vim is a flexible proofreader that has much more highlights to reveal.

In the wake of perusing this article, you currently have different choices for erasing lines and words in Vim. Understanding these commands can help you accelerate working with Vim, as you don’t need to physically eliminate undesirable substances.

Read more
26Apr

How to Become a Linux Kernel Developer?

April 26, 2022 admin Linux

The Linux kernel is the primary constituent of the operating system that involves Linux. It acts as the fundamental alliance between the hardware and the system processes. The Linux kernel not only interconnects these two but also manages all of their resources as efficiently as possible. The word “kernel” means “seed,” and like every seed inside a fruit, the kernel also exists inside the operating system of a computer. Being present within the operating system, the kernel manages all the key functionalities of the hardware, be it a computer, laptop, mobile phone, or server.

The code for the Linux kernel is mainly written in the C programming language, except for a few architecture-dependent portions which are written in the assembly level language. If someone wants to learn Linux kernel and aspires to become a Linux Kernel Developer in the future then they should have a good knowledge of the C language. So, learning the C language is a must for a kernel developer, although learning the assembly language is not mandatory until and unless you wish to work on low-level development for any architecture.

Will you be willing to start your career as a Linux Kernel Developer? Or do you wish to write a Linux driver for a device? Then this article will lead you and impart everything that you should know to become a Linux Kernel Developer. It will also provide you with special tips on how to make a career as a Linux Kernel Developer.

What is Linux Kernel?

The Linux Kernel is a non-proprietary operating system that is accessible to thousands of developers for free. The Linux kernel is a monolithic project that is known for managing all sorts of hardware, file system managers, and driver operations. The Linux kernel is a computer programme that is also referred to as the central part of the Linux operating system (OS). When a driver runs, this kernel part loads into the system first and stays in the main memory until the driver stops. It is also the bottom level of the application system that links with the hardware of the system.

Because it allows the addition and deletion of loaded kernel modules at runtime, the Linux kernel is said to be modular. Furthermore, it only stores the required modules in kernel memory and deletes the rest, improving overall system performance.

Every Linux distribution is organized around the characteristics of the Linux kernel. The Linux kernel is primarily used by well-known Linux distributions such as Ubuntu, Fedora, and Arch Linux. Every distributor acquires all of its services in order to operate various software functions.

More About Linux Kernel

The concept of the Linux kernel was first cemented by Linus Torvalds in the year 1991. He developed the kernel for his desktop as a free operating system. Since then, the Linux kernel has evolved a lot and has supported several computer architectures, including mobile devices, supercomputers, mainframes, etc. It is also used for various free software-related projects. The concept of the kernel has been carried forward globally by thousands of open-source contributors. The Linux kernel code consists of 23 million lines, making it one of the leading open-source software projects worldwide. It has many versions, and each version is valid for up to six years. The Linux kernel came into being under the GNU General Public License version 2 (GPLv2).

What does a Linux kernel do?

The Linux kernel operates all the resources of the operating system and creates space for an application to run. It enhances the usage of the processor and the overall performance and helps the system avoid any kind of deadlock. Besides all these, a kernel has four tasks, including memory management, process management, device drivers, and system calls and security.

Memory Management: keeps a record of the system memory, like how much memory has been used, for what reason, and where it has been used.

Process Management: Regulates which processes in the system can get access to the central processing unit (CPU), when they can get access, and also for how long they can use it.

Device Drivers: The drivers work as a mediator between the computer’s hardware and the system processes.

System Calls and Security: The requests that the system processes make for services are received by the kernel.

The kernel works in its own world, which is better termed the kernel space. Here in this space, a kernel shares further memory with the processes. On the other hand, the world of the user, where they see all the files and browsers, is better termed the “user space.” If the implementation of the kernel is done correctly, then it will be invisible to the users.

What do you mean by Linux Kernel Development?

Linux Kernel Development is an in-depth examination of the design and execution of the Linux kernel.It consists of content where it lists all the beneficial points that a programmer needs to follow while writing and developing kernel code. The study also helps the programmers to get a better understanding of the Linux operating system, making the programmers more proficient and creative with their coding. According to studies, the Linux kernel is well-stabilized and sustained. Hence, many cloud computing infrastructures and cloud solution providers, such as Amazon Web Services and Google Cloud Platform, have put their faith in the Linux kernel because of its stability.

How to set off your career as a Linux Kernel Developer?

As mentioned previously, the Linux kernel is the soul of the Linux operating system. The people who are behind this, i.e., the Linux Kernel Developers, are the silent protagonists of the digital world. Developers have made the lives of businessmen and employees more efficient. Companies and organizations rely on them to ease the work of their employees and help them meet the client’s goals easily.

Like every other profession, that of a Linux kernel developer is very challenging. It takes a lot of hard work, determination, prudence, and adaptability to become a kernel developer. It also requires great commitment and perseverance, but the reward at the end is worth the effort.

There is no shortcut or a single way to achieve this goal. Developers should be well-versed in the domain on which they are working.People who are interested in pursuing a career in this field should follow these five steps to become a Linux Kernel Developer:

  1. Study C Programming Language
  2. Study Data Structure and Algorithm
  3. Study about the Operating System and its Processes
  4. Study about Linux Kernel.
  5. Start doing some Moderate Programming

1. Study C Programming Language

The C language is the first hurdle. Learning C is a must if you want to advance your career as a Linux Kernel Developer and work for a reputable company.It is more of a middle-level language that decreases the breach between the low-level language and the high-level language. The C language is useful for writing various operating systems as well as writing application-based programs. You, being a beginner, will benefit hugely from learning the C programming language as it will help you to have a great understanding of the rudiments of computer theories. Here is a list of a few books to learn about the C language in 2021.

Books Authors
C: The Complete Reference Herbert Schildt
C Programming Absolute Beginner’s Guide Greg Perry and Dean Miller
Head First C: A Brain-Friendly Guide Griffiths David
Expert C Programming: Deep Secrets Peter Van Der Linden

2. Study Data Structure and Algorithm

Having a basic understanding of data structures and algorithms is crucial to becoming a Linux kernel developer. It detects and observes the nature of the problem in-depth and will guide you to overcome it via a step-by-step approach. Knowledge about these two topics not only helps the developer to find the best solution for a problem, but also saves a lot of time and memory space. You can watch all the video lectures and download online materials to clear up your conceptions and theories about data structures and algorithms. Below are some of the books to learn about data structures and algorithms.

Books Authors
Introduction to Algorithms Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein
The Algorithm Design Manual Steven S. Skiena
Advanced Data Structures Peter Brass
Data Structures and Algorithms Made Easy: Data Structures and Algorithmic Puzzles Narasimha Karumanchi

3. Study about the Operating System and its Processes

After studying C programming and data structures, you should learn about the operating system and its different processes. An operating system regulates the memory management of a computer and also controls the hardware and software of the computer. It acts as an interpreter between you and the computer and allows you to interact with it without understanding the computer’s language. Without knowledge of the operating system, you won’t progress much as a kernel developer. Here are some of the best books to learn about OS in 2021.

Books Authors
Operating System Concepts Abraham Silberschatz, Greg Gagne, and Peter B. Galvin
Guide to Operating Systems Greg Tomsho
Introduction to Linux: A Hands on Guide Machtelt Garrels
Operating Systems: Principles and Practice Thomas Anderson

4. Study about Linux Kernel

It is a no-brainer that a Linux kernel developer should study the Linux kernel. Linux is now completely dominating in the digital space and has been known for its stability and reliability. The multitasking environment of Linux allows you to run numerous processes simultaneously. The open-source feature of the Linux kernel enables users to modify and amend kernels according to their priority. Hence, the Linux kernel can be used on a wide range of devices. The few best books to learn about the Linux kernel in 2021 are:

Books Authors
Linux Pocket Guide: Essential Commands Daniel J. Barrett
Linux Command Line and Shell Scripting Bible Richard Blum
Linux for Beginners: An Introduction to the Linux Operating System and Command Line Jason Cannon
Introduction to Linux: A Hands on Guide Machtelt Garrels

5. Start doing some Moderate Programming

Lastly, shift your focus exclusively to programming. When you’re done with all the four steps mentioned above, start doing some moderate-level programming. When you start programming, you will start exposing your brain and it will work out in a very structured manner. It will enhance your thinking capabilities and give you the platform to find creative solutions to problems. The main motive of a developer is not just to solve a problem, but to solve it in a very short time. In the Linux kernel, a developer faces a new problem every day. So, to become a successful kernel developer, it is necessary to solve the problem in a way that allows you to finish coding quickly as well as save some amount of memory space.

Conclusion

The Linux kernel is one of the fastest programs, sometimes starting loading on the start-up menu even before the boot starts loading. A kernel developer manages the computer’s hardware and tracks the memory usage. The developer channels the data to various storage devices and, hence, helps numerous tasks run together simultaneously without any technical hitches.

Most people ask, “How long will it take for you to become a Linux Kernel Developer?” I would say it completely depends on the learner, his or her learning skills, determination level, and hard work. There is no doubt that you’ll be rewarded attractively once you become a Linux Kernel Developer. A successful kernel developer can earn up to $312,000 a year in the United States. On average, the salary of a Linux kernel developer is around $123,500 to $179,500.

Read more
23Mar

How to Become a Linux Administrator?

March 23, 2022 admin Linux

Many IT professionals want to be specialized in Linux operating system. One of the major roles is the Linux administrator, if you are looking for this role then you need to learn how to configure Linux servers and systems. For this, you will require to learn about its basics, certifications, and training. If you want to pursue your career as a Linux administrator then you should be able to monitor the system’s everyday operation and its health.

In this article, we will be focusing on who are Linux administrators, what are their roles, the pathway to becoming a Linux administrator, required certifications, and technical skills.

Who are Linux Administrators?

Linux administrators monitor the everyday working of the Linux system and maintain the health of the system. They mainly focus on security ensuring the security patches are updated and are ready to work effectively. They have to interact with users for any system-related issue and respond to them accordingly with the right solution. They also manage the regular system backups as per the business requirement. They look if the system is performing well, manage the root access, and communicate with the development team for carrying out new releases.

It is not an easy job to be a Linux administrator as you need strong technical knowledge to manage the complete system. For becoming a Linux administrator, you need to have experience working in a Linux environment. There is a great demand for a Linux administrator and it is a high-paid role. Before you start learning the required skills, you need to understand the tasks and responsibilities of a Linux system administrator.

What Does a Linux System Administrator Do?

The main responsibility of a Linux system administrator is to manage and oversee the Linux OS and make sure that it works seamlessly. Their responsibilities include installing and conducting regular maintenance checks, troubleshooting errors, performing fixes, and monitoring the performance of the system to ensure optimal operations. Apart from this, as an administrator, it is important to manage and encourage team members to achieve goals, while following the company’s rules, policies and regulations.

Here we have mentioned some responsibilities of a Linux system administrator.

  • Creating and managing the FTP web interface for transferring the files to customer FTP sites using PHP.
  • Configuring and managing NetApp storage arrays.
  • Managing the NetApp storage devices and user administration.
  • Managing systems volume with the help of SVM, LVM, NAS, VERITAS volume manager.
  • Managing the Black Duck servers — configure on 8 quad CPU and 32GB memory and 16TB storage.
  • Installing, setting up, and managing different distributions of Linux (RHEL, CentOS, etc.)
  • Converting the Linux systems from local password authentication to LDAP and NFS homes for enhancing administrative efficiency.
  • Automating the Linux and MySQL user access across several servers to make the process cost-effective and efficient.
  • Performing frequent system maintenance including the OS and applications patching on Linux servers.
  • Managing the Linux configuration files and software package by using puppet.

However, the roles and responsibilities do not end here. Linux is a vast OS having several functionalities that need to be taken care of. A Linux administrator manages every small aspect of the Linux system.

How to Become a Linux Administrator

You can follow the below-mentioned steps to start your career as a Linux system administrator.

1. Bachelor’s Degree

You should start with getting a bachelor’s degree to become a Linux administrator. You can choose any of the below-mentioned branches to pursue your bachelor’s degree.

  • Computer science (CS)
  • Information technology (IT)
  • Information science
  • Software engineering
  • Telecommunications

2. Master’s Degree

On getting a bachelor’s degree, you can start pursuing a master’s degree in a specific field. With a master’s degree, you can select a specific discipline like computer networking that will help in strengthening your technical skills required for becoming a Linux administrator. You can go for courses like database management and web server administration, which are considered to be important courses for the role. This degree is optional but you can get hold of your technical skills either by online or offline training and courses.

3. Enrolling in Training Courses

You can get enrolled in training courses that will provide you the fundamental knowledge about Linux and its various concepts. These concepts tend to be stronger as you expand your knowledge skills. You can start learning the concepts like writing a kernel and scripts. Not only this, you can get along with the advanced resources to hone your skills.

4. Practice Installing Linux

Apart from theoretical knowledge, one should have the practical knowledge to deal with real-time scenarios. In this way, you will be able to work on the customer’s complaints and resolve their issues. So start with installing Linux, learn how to configure it which is an important and basic step for becoming a Linux administrator. So you can look for the right resource that will guide you through configuring steps. After installing Linux, you can practice and perform basic tasks at the start. Practicing will help you understand your skill level.

5. Get Certified

To check your skill level as a Linux system administrator, you can go for various certifications. These certifications will help you get a good job with a good salary. Today, employers require a person who is certified and having strong knowledge to be a Linux system administrator. These certifications cover different aspects of Linux, so you can complete more than one certification to excel in your field.

Here we have mentioned some of the Linux certifications that you can choose depending on your experience level and specialty:

  • CompTIA Linux+
  • GIAC Certified UNIX Security Administrator (GCUX)
  • Linux Foundation Certified Engineer (LFCE)
  • Linux Foundation Certified System Administrator
  • Oracle Certified Professional (OCP)
  • Oracle Certified Specialist (OCS)
  • Red Hat Certified System Administrator (RHCSA)

The Linux Professional Institute (LPI) provides you a variety of certifications for Linux professionals.

Common Skills Required for Linux Administrators

1. Problem-solving

First, you need to know how to troubleshoot and fix the bugs which are necessary for maintaining the integrity of the system. You should be able to process user requests that will help you in establishing a network pattern. Having the right knowledge and problem-solving skills will make you stand out among other employees.

2. Attention to Detail

To manage the Linux system, you must be quick with understanding and running various commands, as most of the tasks are done by running commands on the command line. A good Linux administrator gives close attention to every detail like what command they are entering and how the system will perform if they provide the wrong command. This will help in troubleshooting errors and fixing them quickly.

3. Communication

Linux administrators should be active listeners and should pay attention while communicating with others. As they work closely with network engineers and developers, they need to focus on details and should be able to provide answers to their technical questions. They should be able to communicate with users in less technical terms to explain to them the error and its root cause.

4. Technical skills

Here, we have mentioned some of the technical skills required to become a Linux administrator.

  • Ability to understand the concept of Linux file systems. They should know what systems are supported by Linux to configure the network.
  • They should have a hold of the File system hierarchy as Linux systems have a unique format, and Linux system administrators are capable of knowing what location they can use to store specific files.
  • Ability to use the command line efficiently for running various commands to perform several tasks. Administrators generally have the root or admin access which is the highest access for managing Linux systems.
  • Ability to manage disaster recovery where they will create backup and restore files in Linux systems and reboot the system if required to prevent the loss of crucial information.
  • They should be able to understand the network security and firewalls. Only Linux administrators can help in establishing the security protocols.

Conclusion

Linux is available as open-source and is a very vast operating system. This increases the responsibilities of a Linux system administrator as they have to manage every aspect of the Linux system. If you want to pursue a career as a Linux system administrator then you have to be technically sound in almost every field like networking, command line, and others. In this article, we have mentioned some of the roles and responsibilities that you can understand before you start learning the concepts. You can follow the easy steps to become a Linux system administrator by acquiring the basic technical skills.

Read more
26Jan

Date Command in Linux

January 26, 2022 admin Linux

When using the Linux command line or writing Shell scripts, we may need to deal with date and time variables, such as displaying a date or time in a certain format, obtaining a relative date-time, or modifying the device date and time.

The Date command in Linux displays and changes the current date and time on the system. Users can also display the time in various formats and compute upcoming and previous dates using this function. The blog explains how to format dates in Linux and Unix platforms.

Date Command in Linux

Because the Date command is part of the GNU Coreutils package, it comes preinstalled in all Linux distributions. Before proceeding, consider the following prerequisites:

  • An individual should have a Linux-based system.
  • A user account with administrative powers.
  • A terminal window/command line is required.

The date command has the following syntax:

date [option]… [+format]

If no option is given with the command, then the output will be the current system’s date and time, including the day of the week, month, time, year, and timezone:

$ date

Tue 13 Jul 2021 05:34:45 PM CET

The Date command can however do more if we supply other options to it. The date command is commonly used in the following ways:

  • Showing the current date and time in a particular timezone
  • Showing the date and time in the desired format
  • Displaying date and time in the given strings
  • Getting relative date and time
  • Setting the device date and time

How to Use date Command in Linux

Enter the following date command to see the current system time and date:

Date

The weekday, month, year, current time, and time zone are all displayed in the output. The date command is configured for the operating system’s time zone by default. Users can utilize the -d option for operating on a given date. We can enter the following command, for instance:

date -d “2000-11-22 09:10:15”

The —Date command displays a date in the format specified by the date string. This command has no effect on the system’s actual date and time values; it merely prints the date you choose. Consider the following scenario:

date –date=”09/10/1960″

Linux Date Command Format Options

Control characters followed by a + sign can be used to modify the date command’s output. The percent symbol precedes the format controls, which are then replaced by the current values. The % Y symbol is substituted with the present year, the month is swapped with the month, and the day of the month is replaced with the actual day:

date +”Year: %Y, Month: %m, Day: %d”

Nearly every formatting characters for date command is listed below:

%FORMAT String Description
%a The abbreviated weekday name of the location. For example- Tue
%A The entire weekday name of the location For example- Tuesday
%b Shortened month name of the location. For example- Feb
%B The whole month name of the location, such as February
%c Date and time. For instance- Thu Mar 3 23:05:25 2005)
%d day of the month, for instance- 04
%D Exact date. Similar to %m/%d/%y
%F Mentioning complete date such as “%Y-%m-%d”
%g Two digits from the end of ISO week-numbering
%H Showing 24 hours format
%I Showing 12 hours format
%j Displaying the day of the year
%m Month (In number between 1 to 12)
%M Showing minute (Can be any number between 1 to 59)
%n Adding a newline
%j Mentioning the day of the year (Can be any number from 1 to 366)
%N Displaying nanoseconds (Can be any number between 000000000..999999999)
%p AM or PM in your locale; leave blank if you don’t know.
%P Similar to %p, but displays the result in lower case
%S Adding seconds (between 0 to 60)
%t A tab
%T Adding time, similar to %H:%M:%S
%u Displaying day of a week (from 1 to 7)
%U Mentioning the week number. Can be from 1 to 53, because there are 53 weeks in a year
%V ISO week number
%w Mentioning the day of the week
%x Locale’s format of representing date. For example- 12/31/99
%X Locale’s format of representing date. For example- 12:31:99
%y Two digits from the end (In year)
%Y Displaying the year
%z +hhmm numeric time zone
%:z +hh:mm numeric time zone
%::z +hh:mm:ss numeric time zone
%:::z numeric time zone with “:” for more precise information
%Z acronym for the time zone in alphabetical order

Setting or Changing Date in Linux

Use the —set command to manually modify the system clock. For setting the date and time to 4:20 p.m. on July 13, 2014, for instance, enter:

date –set=”20100513 05:30″

The system clock in many of those Linux distributions is synced via the ntp or systemd-timesyncd services, therefore be cautious when manually changing the clock.

Display Past Dates

To see dates from the previous era in Linux, utilize the —date command. “Tomorrow,” “Friday,” “last Friday,” “next Friday,” “next week,” and some other values are accepted by the date command. For printing previous dates, execute the following strings:

date –date=”X year ago”

Show Upcoming Dates

The —date option can also be used to show dates in the future. You can enter in strings to print upcoming dates, just like you can with past dates:

date –date=”next monday”

Displaying the date strings at the file’s line

The —file command displays the date string that appears at the beginning of each line in the file. The —file option, unlike the —date option, can show multiple date strings on every line. The —file command has the following syntax:

date –file=file_name.txt

Show the Date File’s Last Modified Timestamp

The date command reports the last change time of a file if you specify it with the -r option. The below-mentioned command will print the last instance when the host’s file get changed:

date -r /etc/hosts

Overriding a Time Zone

The date command utilises the local time specified in /etc/localtime by default. Set the TZ parameter to the preferred standard time to utilise a different time zone in the environment. To change to New York time, for example, type:

TZ=’America/New_York’ date

To reset the machine to its original time zone, use the date command. Use the timedatectl list-timezones command to examine all possible time zones.

The date command can be utilised for displaying the time in another local time. For example, to see the local time on the Australian East coast at 11:20 pm upcoming Monday, enter:

date -d ‘TZ=”Australia/Sydney” 11:20 next Monday’

Using Date with Other Commands

The Date command can be used to generate system files that include the current time and date. The following command produces a duplicate MySQL file in the present date format:

mysqldump database_name > database_name-$(date +%Y%m%d).sql

Shell scripts are another typical application of the Date command. The output of date is assigned to the date now variable as follows:

date_now=$(date “+%F-%H-%M-%S”)

Conclusion

The Date command displays or modifies the date and time on the system in Linux. In addition to displaying the time in various formats, this function can also be used to calculate upcoming and previous dates. This blog discusses how the Date command can be used in Linux in all of its major uses. I hope you found this information useful.

Read more
20May

How to Remove Files and Directories in Linux?

May 20, 2021 admin Linux

If you mostly use Windows or Mac systems, you might be unfamiliar with the Linux-based operating systems. If you are new to Linux and trying to remove files from your computer, you may need to know some easy commands that will help you to achieve the same. So, let’s talk about how to easily remove files and directories in Linux distributions. In general, your computer must have a file manager from where you can access and manage all the files stored in your system.

For example, Gnome’s Files or KDE’s Dolphin lets you delete files and directories from their interfaces only. However, you cannot use those tools while you are working on the headless server. So, opening the terminal and using a few command lines is the best option. Read the entire article to uncover some basic and advanced commands such as rmdir, rm, and find to remove files and directories in Linux.

Before You Start to Delete Files on Linux

Like Windows and macOS, you can move your files or directories to the trash and recover them whenever you want. This way, you can remove the files temporarily and also get them back whenever required. 

However, if you delete the files or directories using the command line, it is going to be deleted permanently. Once you delete the files with the command line, you cannot recover them back. 

Also, you should make sure that in most cases, removing files and directories from your Linux system requires you to write permission on the directory and the content. If you don’t have permission, it will show you the “Operation not permitted” error. 

Also, note that whenever you put a directory name that has a space in it, you need to replace that space with a backslash (/).

Ways to Delete Files Using the rm Command in Linux Terminal

Commands such as rm, unlink, and rmdir help you remove files and directories from the Linux terminal with ease. This section is to talk about the rm command. The easiest way to delete something, a directory or a file on your Linux system is to use the rm command, give a space, and type the name of the file/directory that you want to delete.

rm file_1.txt

If you don’t find the file in the current directory, you can provide the path of the file’s location. Check out the command below:

rm ./path/to/the/file/file_1.txt

If you type more than one file name in the rm text, it will delete all the files altogether at the same time.

rm file_2.txt file_3.txt

You can also use the “*” and “?” symbols to delete multiple files of the same file extension. The “*” symbol represents multiple files, while the “?” symbol represents a single character. If you are still in the current directory, the “*” symbol will delete all the files of the extension you put in. For example, the command shown below will delete all the png files located within a specific directory:

rm *.png

If you use the ‘rm *.?’ command, it would delete all the files that have a single character extension, i.e, it would only delete.png1 and .png2, but not .png12. If a file is protected with a code or something, the system will show you a prompt before you can delete it. Simply type y or n and press “Enter.” But you can use the rm commands with the -i (interactive) option instead of the wildcards option, which will give you an option to confirm or decline the deletion. 

rm -i *.dat

However, if you don’t want to find that last option before deleting your files, you can use the f (force) option instead. Unlike the interactive one, it does not deliver a confirmation prompt. There is another option which is the -v: Verbose option, that will show you what rm is doing on the screen.

Steps to Delete All Files in the Linux Directory

Here is the process for deleting all the files in a selected Linux directory:

  • Open the terminal application in your Linux system.
  • Run the rm /path/to/dir/* command in a directory that will delete all the files and everything in a particular directory. Just be assured to replace the terms with the actual value. For example, replace the path with the actual location of the folder. 
  • To remove all sub-directories and files in the location, work with the rm -r /path/to/dir/* command line. 

Deleting Hidden and Non-Hidden Files 

In the Linux operating system, if you find a file or a directory that starts with a (.) dot character is a dot file. The dot file is basically treated as a hidden file in the directory. If you want to see if the hidden files pass the -a to the ls, you can run the following commands:

ls
ls -a
ls -la

If you want to remove all the files in the directory but want to keep the hidden ones, you can use the below commands.

rm /path/to/dir/*
rm -rf /path/to/dir/*
rm *

You can also delete all the files in your selected directory along with the hidden ones. Just  run the below command:

rm -rf /path/to/dir1/{*,.*}
rm -rfv /path/to/dir1/{*,.*}

Bash Can Remove All Hidden and Non-Hidden Files

Bash is a scripting language that can delete all the hidden and non-hidden files from a directory if the dotglob option is set. It will delete the files that begin with a ‘.’ from the results of pathname expansion. You can turn on the dotglob option to delete files easily.

# Bash shell and may not work on other shells
# Turn on dotglob (set) #
shopt -s dotglob
# Remove all files including hidden .files #
rm -v ~/project/oldfiles/*
rm -vrf ~/project/oldfiles/*
# Turn off dotglob (unset) #
shopt -u dotglob

How Can You Delete Directories with the rm command?

‘rm’ can help you delete filled and empty directories on your Linux system. However, to remove empty directories, you will have to use the -d or (–dir) option or if you want to delete a filled directory with all its content inside, you will have to use the -r (–recursive or -R) option. For example, if the directory name is dir1 and you want to delete it along with all its content, you will have to use the following command:

rm -r dir1

If the files or the directory itself is protected with something or is write-protected, the system will show you a confirmation prompt. If you don’t want to see the prompt, as we said in the previous section, use the  -f option as shown below:

rm -rf dir1

Delete Multiple Directories At Once

You can remove multiple directories at once with the rm command along with the names of the directories separated by spaces after the rm command. Follow the direction stated below:

rm -r dir1 dir2 dir3

The -i or the interactive option will tell rm to show you the confirmation prompt where you can confirm to remove every subdirectory and file within a directory. But if there are multiple subdirectories in the location, it will show you multiple confirmations prompts, which will become quite annoying. You can press y and hit the Enter button if you want to remove the entire directory:

rm: remove 1 argument recursively? y

However, users can also use the regular expansion option to match and delete different directories at the same time. If there are _bak directories in the current directory, you can use the following command:

rm -r *_bak

However, this way of deleting directories is risky as the match system may not work all the time accurately. First, list the directories that you want to remove with the ‘ls’ command and then delete them using the ‘rm’ command. 

How to Remove Files and Directories with the Find Command?

Make use of the Find command-line utility to search for files and directories and delete them. You can use the find command to delete files and directories that run on a particular pattern of expression. Suppose there are several _cache files in your current directory; simply use the Find command to search for them and finally delete them. For this, you should run the following command:

find . -type d -name '*_cache' -exec rm -r {} +
  • /dir – recursively will search the current working directory (.)
  • -type d will restrict the search to the directories
  • -name ‘*_cache’ will only search the directories that have the _cache name at the end
  • -exec will open up an external command with rm -r
  • {} + will write more data to the end of the rm command line

How to Remove Directories with rmdir

With the rmdir command, you can only remove empty directories. So, whenever you are required to delete files, you can use the rm command and the rest of the time, use the rmdir command to remove empty directories from your Linux system. You can transfer the name of the directory to rmdir with the rmdir directory command. Or you can delete multiple empty directories by passing a list of directory names to rmdir:

rmdir directory1 directory2 directory3

If you want to delete a directory outside of the current directory, you can put the full name of that directory.

rmdir /path/to/directory

If you try to delete a directory that is not empty, it will show you an error message. The error message may read like: –ignore-fail-on-non-empty.

How to Remove Files Using the Unlink Command in Linux? 

If you have not used the rm command to delete files from a Linux directory, you can use the unlink command. However, with it, you can only remove a single selective file, but with the rm command, you can delete multiple files at once, which is easy. But the former solution lets you keep the important files and remove the ones you don’t need, so the unlink command is helpful. To delete the particular file, use the unlink command and mention the name of the item next to it:

unlink filename

If the file that you are trying to delete is write-protected, it will show you a confirmation message. To delete the same file, you can type y and hit Enter. However, if the file is not write-protected, it will be deleted immediately. 

rm: remove write-protected regular empty file 'filename'?

Conclusion

This article showed you how to remove files and directories in a Linux system with different commands. If you need more help, check out our other articles or drop us a comment below.

Read more
29Apr

How To Find Linux Reboot Reasons?

April 29, 2021 admin Linux

Is your Linux system unexpectedly shutting down or rebooting on its own? Well, there are several reasons for an unexpected shutdown or reboot of your Linux system, like excessive heating, hitting the power button, low battery in case of laptops, etc. But for Linux servers, you must check what caused the system reboot. You can identify the cause in a number of ways but first of all, you must understand why system reboot matters.

What Does Reboot Mean in Linux Systems?

In Linux, whenever you complete software or a network update, you need to reboot the system so that the change becomes effective on the system.

But what if your Linux system is rebooting unexpectedly? If you’ve updated any malicious software on the network, it can be dangerous for your PC which may lead to frequent reboot sessions. There can be other reasons too. That’s why if your system is rebooting unexpectedly, except for the reasons mentioned above, you must find out the reasons behind it.

Different Ways to Find Linux Reboot Reasons

Here are some of the best ways to trace the reasons that caused your Linux system to reboot:

1. By Inspecting Reboot Time

If you want to know the reason for the reboot, first of all, it is important to know the time of the reboot. To know the date and time of system reboot, you can use the following commands:

  1. Uptime – This command tells the time for which the system has been running along with the current time, and the average load.
  2. Procinfo – This command collects the data from the proc directory and displays it on your system.
  3. Who – This command lists down the users who are using the system presently.
  4. Last – The Last command provides a user’s login information.
  5. Stats – This command displays the status of the desired file or a file system.

2. Check The Messages

Now you know the reboot time, it’s time to check who triggered the reboot. It can be a system administrator or a root user, one with Sudo privileges. Checking the messages will be useful here. These messages store the information about the reboot. You need to access the log files to access these messages by using the tail command or using any desired editor to filter the data. It also depends on the OS type, e.g., var/log/messages contain the log file in RHEL/ CentOS systems, and var/log/syslog does the same for Debian and Ubuntu systems.

These messages do not reflect everything. You need to look for any signs that tell what caused the trouble and forced the system to reboot.

3. Inspect Auditd Logs

To check different events, auditd is a great place to check them. Its au search tool will show you the two most recent reboots when you execute the following command:

au search –i –m system_boot, system_shutdown| tail -4

Now, this command will display the results and you can ascertain if the system reboot was graceful or not. As a result, if you see one shutdown and one system boot, it is alright, but if there are two system boots lined up in a row, it means that there is a problem.

4. SystemdJournal for Reboot List

If you want to maintain a list of the reboots, you can do so by changing the settings of the system journal. To create your own directory, you can take the help of these commands:

var/log/journal
system- tempfiles –create –prefix /var/log/journal 2
systemctl –s SIGUSR1 kill systemd –journald

You can also simply make the changes in the /etc/system/journal.conf command. Now, you can call for the list of reboots by using the following command:

$ journalctl –list - boots

To Wrap it Up

The aforementioned commands are not to be used in an isolated manner because they may not be of much use. You need to collect entire data using different commands and their combinations. There is no one particular reason for a reboot to occur. Sometimes, the reboot happens due to a software update while other times, it may be due to overheating or accidental pressing of the power button.

Read more
03Apr

How to Fix Kernel Security Check Failure?

April 3, 2021 admin Linux

The main reason why you landed up on this blog must be the BSoD (Blue Screen of Death), which is an annoying blue screen that shows a specific stop. It appears when there is a Kernel Security Check Failure due to various reasons. 

Many users experience this blue screen after upgrading to Windows 10, and it can occur quite frequently. There can be many different reasons behind the occurrence of BSoD, like memory issues, virus infections, and more. However, the most common reasons are the ones below:

  • Corrupted Windows system files
  • Memory problems and outdated drivers
  • Viruses or inadequate security programs
  • A corrupted or damaged hard disk

Situations that Can Trigger BSoD

  • After sleep

Kernel Security Check Failure may occur after waking your PC from sleep.

  • After a RAM upgrade

This blue screen can occur after inserting a new RAM card.

  • While playing games

You may encounter this error while playing games.

  • While using specific apps and programs

It is also possible that particular apps and programs may trigger kernel security check failure to occur frequently. 

10 Ways to Fix Kernel Security Check Errors in 2021

1. Check memory problems

To check memory problems, Windows has a built-in memory diagnostics tool that identifies memory problems and makes the whole process a cakewalk. Follow the steps mentioned below to run the memory diagnostics tool in Windows 10:

Step-1: Launch the memory diagnostics tool

Type memory or mdsched in the Cortana Search box. Open the Windows Memory Diagnostic tool.

Step-2: Check for problems with the tool

Choose from the following two options that will be displayed on your screen:

  • Restart now and check for problems.
  • Check for problems the next time I start my computer.

On discovering a memory problem, you have to replace the current memory card with a new one.

2.  The legacy advanced boot menu

Another way to resolve the Kernel Security Check Failure is to enable the legacy advanced boot menu. Follow the steps mentioned below to achieve the same:

  • Restart your computer. Insert a Windows 10 bootable media into the optical media drive 
  • Right after clicking on Next, click on Repair your computer, then select troubleshoot
  • Now click on advanced options, then hit Command prompt option
  • A new Command Prompt window will open and type ‘C.’ Run the following command and hit enter to enable the legacy advanced boot menu.

 

BCDEDIT /SET {DEFAULT} BOOTMENUPOLICY LEGACY

BCDEDIT /SET {DEFAULT} BOOTMENUPOLICY LEGACY3. Use system file checker and memory diagnostic

To use this method, follow the steps mentioned below:

  • Go to Settings, select Advanced Startup and open See advanced repair options menu
  • Under the Advanced Options icon, click or tap on Startup Settings
  • Left-click the Restart button. After this, your operating system will boot in the minimum system requirements
  • Left-click on the Search feature and type cmd
  • Click on Run as administrator. The command prompt will open with full privileges
  • Run as administratorRun sfc /scannow command and hit Enter.
  • Wait until the scanning process completes and exit the window.
  • Again, go to the Search feature and type memory, and select Run as administrator under Windows Memory Diagnostic.
  • Windows Memory DiagnosticAfter rebooting, the OS will automatically analyze RAM and show all the possible reasons for the Blue Screen of Death error.

4. Install, uninstall, or update drivers

One of the most common reasons for Kernel Security Check Failure in Windows 10 is the newly installed drivers, outdated drivers, or incompatible drivers. Therefore, if you’ve installed a new hardware driver or upgraded to Windows 10, then you can uninstall or reinstall a driver. You need to run the Windows built-in Driver Verifier Manager to check for corrupt drivers automatically. After that, follow the steps mentioned below to uninstall, reinstall, or update them.

Step-1: Launch Device Manager

  • Right-click on the Windows 10 start menu and open Device Manager
  • You can search for “Device Manager” in the Windows search box.

Step-2: Uninstall, reinstall or update the drive

Follow the below-mentioned steps one-by-one to uninstall, reinstall or update a driver:

  • Search for the device driver that may be working incorrectly.
  • To select the ‘Update driver’ or ‘Uninstall device’ option, right-click on it. 

5. Run system restore

System restore comes in handy for fixing system issues. It will help you to bring your computer to an earlier state. You have to choose a restore point to revert your computer to a previous state, which does not have the kernel security check failure.

6. Use safe mode

If you don’t want to reboot your PC for some reason, you can try booting it in Safe Mode that will help you identify the apps or software that are causing this problem (if any). 

If there’s no problem discovered in safe mode, it means that an app or software indeed triggers the problem. You can further use programs one by one to identify the culprit, and after finding it, you can uninstall the problematic software.

7. Check memory slot

Before hopping into time-taking and hectic techniques, make sure to check the memory slot first. Ensure that it is correctly placed into the socket and is functioning correctly. Try and replace the memory slot or change the space in which it is plugged into the motherboard. Reboot your PC to see if they stop code Kernel Security Check Failure persists.

8. Update your OS

Since Microsoft continually rolls out new updates to improve the system’s stability and fix various issues, it is recommended to make sure that your machine has the latest Windows OS updates installed in it.

Hop on to the Windows Update section by merely typing “update” in the search box. Then go to Windows Update and check for updates and install the available updates.

9. Check your disk for errors

One of the best ways is to run a disk check using Command Prompt on Windows 10. Follow the steps mentioned below to achieve the same:

  • Run command prompt as administrator and run chkdsk C: /f command.
  • The chkdsk D: /f command will help you detect and repair logical issues affecting your drive.
  • To repair physical issues, run the /r parameter.

10. Do a clean install on Windows 10

If you could not fix kernel security check failure by any of the methods mentioned above, you should perform a clean install of Windows 10. But before making the clean install, ensure to follow the steps to backup your system disk in advance. This will prevent all your data from getting lost.

Backup system disk

  • Select the disk and copy the content and click Next. A window will pop-up; hit yes to continue.
  • Review and click Next to continue.
  • Now select the target disk to copy the content.
  • Click on Apply to allow the pending operations.

Install Windows 10

  • The first step is to create a Windows 10 installation media USB drive.
  • Now restart and boot from the USB drive.
  • At last, Install Windows 10 by selecting the language preferences and clicking on ‘Install Now’. You can either enter the license key or click ‘I don’t have a product key’ to skip it and enter it later.
  • Finally, accept the license terms and click Next.

Conclusion

The “Kernel Security Check Failure” error and the BSoD (Blue Screen of Death) are quite frankly some of the most annoying errors you could encounter on Windows 10. However, as mentioned throughout the blog, there are plenty of solutions to eliminate the same.

Read more
05Mar

SFTP Commands in Linux

March 5, 2021 admin Linux

SFTP is also known as Secure File Transfer Protocol that offers you a secured file transfer facility based on the FTP (File Transfer Protocol). Earlier, all the transfers were done via unencrypted and insecure FTP. That is why we need a secure way to transfer all the files and develop the SFTP process.

SFTP works on the SSH protocol using the TCP port number 22, offering similar security and encryption functionalities as SSH. There is always a default SSH daemon that runs as a part of the OpenSSH server on the Linux systems, supporting SFTP protocol features.

With SFTP, you can benefit from a secure and encrypted connection for transferring the files from the local system to the remote system and vice versa. Most companies prefer SFTP because of the obvious security advantages SFTP has over FTP. In this article, we will go through the working of SFTP, its advantages, and various SFTP commands for Linux systems.

Working of SFTP

Well, there is no doubt that SFTP (SSH File Transfer Protocol or Secure File Transfer Protocol) ensures more security while securing the server to server file transfers between your clients and you. Before moving forward, you should understand the working of SFTP.

SFTP uses the SSH (Secure Shell) data stream for establishing a secure connection and ensuring a high level of protection during file transfer. SFTP uses various encryption algorithms that allow you to move your data to the server securely and keep the file encrypted during the transfer. It also provides authentication to avoid unauthorized access to the files during transfer and protect them from hackers.

SFTP does not ensure two-factor authentication; thus, for creating a more secure connection, you will require both a username and password along with SSH keys. By implementing SSH keys will keep away the hackers from being connected to the SFTP server. For this, you need to generate the SSH keys beforehand.

SFTP is implemented on a client-server architecture. The server is used to store data and is located at multiple places that the clients can access by sending requests. The client’s request traversed through the network and reached the server. Then the server responds to the user’s server by sending the required file.

Throughout the process, SFTP makes sure that your data is encrypted, and SSH keys will transfer the public key for providing the access.

What is SFTP?

Features of SFTP

Below are some features of using SFTP.

  • It offers secure and encrypted file transfer.
  • It provides complete support for TMUX and screen sessions.
  • It is capable of implementing the SSH3, IPv6 HTTP protocols.
  • You will be able to run various commands using the SSH terminal.
  • It comes with a password and public-key authentication.
  • It allows you to handle the server key re-exchanges functionality.

Advantages of SFTP

Below are some advantages that you can leverage using SFTP.

  • You can easily install the software and use it without the requirement of root privileges.
  • SFTP protocol works on the secure channel, which means the data will be transferred in an encrypted way keeping the hackers away.
  • It ensures fast and efficient transfer of even large files. You can even transfer multiple files simultaneously.
  • SFTP enhances productivity by allowing the users to work with server and server-to-server facilities.

Disadvantages of SFTP

Below are some disadvantages that you may face using SFTP-

  • The communication via SFTP is binary, and you cannot log the transfer.
  • It may be challenging for managing and validating the SSH keys.
  • SFTP has some standards, providing you with some optional and recommended fields. It may create compatibility problems if you use different software from different vendors.

SFTP Commands

There are various scenarios where we can use SFTP commands.

Copying files

You can use SFTP as an alternative to SCP (secure copy) command. Earlier, the SCP command was used for pushing and pulling files from a remote server in a simple step. First we will look at how SCP works and then moves to the SFTP command for copying files.

SCP command for uploading the file.

$ scp {local-path} {user}@{remote-host}:{remote-path}

SCP command for downloading the file.

$ scp {user}@{remote-host}:{remote-file-path} {local-path}

The alternative SFTP command for uploading the file to a remote server is given below.

$ sftp {user}@{host}:{remote-path} <<< $'put {local-path}'

You can consider the below example:

The alternative SFTP command for downloading the file from a remote server is given below:

$ sftp {user}@{remote-host}:{remote-file-name} {local-file-name}

You can consider the below example:

Connecting to the SFTP server

For establishing a connection to the remote server, you can use the sftp command followed by the user name and the remote’s hostname or IP address. By default, TCP port 22 will be opened for this, or you need to mention the port using the -oPort flag explicitly.

If you are connecting to any server for the first time, you will be asked to confirm the SSH for the server. After you confirm, you will be asked for the password. Only then you can enter the sftp prompt as shown below.
OP 1

Checking Version

Using the SFTP command, you can check the SFTP version as shown below.

OP 2Showing working directory

You can navigate to the current working directory of the remote server by using the pwd command on the SFTP prompt, as shown below.

OP 3

  • lpwd – display the current directory on your local system
  • pwd – display the current directory on the FTP server

Listing files

To list all the files available in a remote working directory, you can use the ‘ls’ command using the sftp prompt, as shown below.

For Remote Working Directory

sftp> ls

Output

sftp> ls
rem_file1     rem_file2     rem_file3     remote_test_dir
sftp>

For Local Working Directory

sftp> lls

Output

sftp> lls
bin  file1  file2  file3  lib    sys_info.sh  test.tgz  testdir
sftp>

Switching directories

You can use the cd command for switching the remote working directory, as shown below.

SD 1If you want to switch the local working directory, you can use the ‘lcd’ command on the SFTP prompt, as shown below.
SD 2

Uploading files

If you want to upload a single file to the remote server, you can use the ‘put’ command. You can see the working using the below example-

Uploading Single File

sftp> pwd

Remote working directory: /home/lo_user

sftp> lpwd
Local working directory: /home/user
sftp> ls
rem_file1     rem_file2     rem_file3     remote_test_dir
sftp> lls
bin  file1  file2  file3  lib    sys_info.sh  test.tgz  testdir
sftp> put file1
Uploading file1 to /home/lo_user/file1
file1                                                                                                                                                                          100%    6     6.0KB/s   00:00
sftp> ls
file1            rem_file1     rem_file2     rem_file3     remote_test_dir
sftp>

Uploading Multiple Files

sftp> pwd
Remote working directory: /home/lo_user
sftp> lpwd
Local working directory: /home/user
sftp> ls
file1            rem_file1     rem_file2     rem_file3     remote_test_dir
sftp> lls
bin  file1  file2  file3  lib    sys_info.sh  test.tgz  testdir
sftp> mput file[23]
Uploading file2 to /home/lo_user/file2
file2                                                                                                                                                                          100%    6     6.5KB/s   00:00
Uploading file3 to /home/lo_user/file3
file3                                                                                                                                                                          100%    6     5.3KB/s   00:00
sftp> ls
file1            file2            file3            rem_file1     rem_file2     rem_file3     remote_test_dir
sftp>

Downloading files

You can download as single or multiple files from the remote server to the local server.

Downloading a Single File

sftp> pwd
Remote working directory: /home/lo_user/remote_test_dir
sftp> lpwd
Local working directory: /home/user/testdir
sftp> ls
Remote_file4
sftp> lls
File4
sftp> get remote_file4
Fetching /home/lo_user/remote_test_dir/remote_file4 to remote_file4
/home/lo_user/remote_test_dir/remote_file4                                                                                                                                     100%   13     5.2KB/s   00:00
sftp> lls
file4  remote_file4
sftp>

Downloading Multiple Files

sftp> pwd
Remote working directory: /home/lo_user
sftp> lpwd
Local working directory: /home/user/testdir
sftp> ls
rem_file1     rem_file2     rem_file3     remote_test_dir
sftp> lls
file4  remote_file4
sftp> mget remote_file*
Fetching /home/lo_user/rem_file1 to rem_file1
/home/lo_user/rem_file1                                                                                                                                                     100%   12     5.9KB/s   00:00
Fetching /home/lo_user/rem_file2 to rem_file2
/home/lo_user/rem_file2                                                                                                                                                     100%   13     5.8KB/s   00:00
Fetching /home/lo_user/rem_file3 to rem_file3
/home/lo_user/rem_file3                                                                                                                                                     100%   13     7.3KB/s   00:00
sftp> lls
file4  rem_file1  rem_file2  rem_file3  remote_file4
sftp>

Creating directory

You can use the ‘mkdir’ command for creating a new directory on a remote server and local server.

Creating Directory on the Remote Server

sftp> pwd
Remote working directory: /home/lo_user
sftp> ls
file1  file2   file   rem_file1  rem_file2  rem_file3    remote_test_dir
sftp> mkdir new_dir
sftp> ls
file1   file2  file3   new_dir  rem_file1  rem_file2  rem_file3     remote_test_dir
sftp>

Creating Directory on the Local Current Working Directory

sftp> lpwd
Local working directory: /home/user
sftp> lls
bin  file1  file2  file3  lib    sys_info.sh  test.tgz  testdir
sftp> lmkdir new_local_dir
sftp> lls
bin  file1  file2  file3  lib  new_local_dir    sys_info.sh  test.tgz  testdir
sftp>

Removing directory

You can remove any empty directory using the ‘rmdir’ command. If the directory is not empty, you may experience an error.

sftp> pwd
Remote working directory: /home/lo_user
sftp> ls
file1            file2       file3       new_dir     rem_file1     rem_file2     rem_file3     remote_test_dir
sftp> rmdir new_dir
sftp> ls
file1            file2       file3      rem_file1     rem_file2     rem_file3     remote_test_dir
sftp>

Conclusion

SFTP is one of the commonly used options for securely transferring files from one server to another. It comes with CLI and GUI features that can be easily supported across various platforms. We have mentioned various commands that are frequently used by any person working with servers and transferring files. You can go through the commands. These are easy to remember and implement. If you want to start practicing the SFTP commands, these are the basic ones to start with.

Read more
07Feb

How to Install Docker on Linux?

February 7, 2021 admin Docker, Linux

Docker is an emerging technology that is gaining popularity around the world. It is a containerization platform that helps you to build and deploy container-based applications on different platforms.

With Docker, you can easily break down the complex applications into microservices stored within a container. You can deploy these containers on various platforms without worrying about the underlying system specifications.

Docker leads to less resource consumption as it shares the underlying OS kernels. If you are an IT operations professional, then you might understand the benefit of implementing Docker technology within the DevOps lifecycle through the software development phase.

Disadvantages of VMs and the Emergence of Docker

Earlier, virtual machines solved the requirement of running various applications isolated from each other but resulted in high-resource consumption and were also hard to handle. Docker came into the picture and solved the shortcomings of VMs.

You can run Docker efficiently either on-premises, over the public cloud, or in a hybrid setup. Docker is based on containers, images, volumes, and networks that can be run on the same host without interfering with each other’s work. Handling multiple containers at the same time has become more comfortable with various tools from Docker and third-parties.

Docker is an open-source project which comes with a large, expanding community support. It has been available since 2013. Over its run, Docker has provided immense growth to the containerization and microservices concepts.

Docker displays cross-platform compatibility. In this article, we will learn how to install Docker on Linux. Before going into that, let us first know the prerequisites for installing Docker on Linux.

Basic Prerequisites for Installing Docker on Linux

With this article, you will be able to install Docker simply. But you must fulfill the necessary system requirements to start with the process, which are:

  • Ubuntu 18.04 or newer 64-bit version.
  • Create a user account with sudo privileges for Ubuntu to run the Docker commands.
  • If you do not have basic command-line knowledge, groom yourself with basic command-line/terminal knowledge.
  • Navigate to the Terminal (CTRL-ALT-T or Applications menu > Accessories > Terminal) for running Docker commands, like installing and setup.
  • You should have a Docker repository that will store the Docker software (OPTIONAL).

How to Install Docker on Linux?

If you have installed Docker on your system already, please check and confirm that the Docker’s installation package version is the latest.

If the installed Docker software is not the latest one available, then you should try installing the latest version from the Docker repository. Once you confirm the version, you can simply start with the below-mentioned steps:

Step 1 – Updating the Docker packages

To update the Docker system and packages, you have to run the following commands:

sudo apt update

sudo apt upgrade

Having an updated system will provide a compatible environment to run further commands in Docker.

Step 2 – Deleting the Docker’s older version

If you have the older version of Docker installed on your system, you can run the below command to get rid of it:

sudo apt-get remove docker docker-engine docker.io

Step 3 – Install the Docker prerequisite packages

You should have the proper Docker package to extract the Docker files and related installation details. For downloading the required Docker package, you can run the below command:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

where,

  • apt-transport-https –> It will use the https secured connection to transfer the required files and data.
  • ca-certificates –> It will confirm the validity of the security certificates for the web browser and your machine
  • curl –> It will transmit the data needed
  • software-properties-common –> You can add the script using this parameter to manage the software.

Step 4 – Adding GCP key for Docker

You can add the Docker’s GCP key using the command below:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

A demonstration of the same is:

Adding GCP key for DockerStep 5 – Docker repository is added to the APT resources

If you want to use the official method to install the Docker, then you should add the latest Docker repository to the resources. You can run the following command to ensure that:

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”

You will see something like this:

Docker repository is added to the APT resources

Step 6 – Running the package database update

Once you update the repository, you can update the list of packages with the help of the latest updates repository. If you want to update your package database, you can run this command:

sudo apt update

Step 7 – Checking and Confirming the Docker repository

With the below command, you can make sure that you are installing the Docker repository rather than the Ubuntu default repository:

apt-cache policy docker-ce

After running the above command, you will get the following output, of course, with a different version number:

Checking and Confirming the Docker repositoryStep 8 – Running the Docker installation command

With the following command, you can install the latest version of Docker on your system:

sudo apt install docker-ce

But if you want to install a particular version of Docker, you can run the below command in the terminal window:

apt-cache madison docker-ce

You’ll get a screen like this:

Running the Docker installation commandOnce you run the above command, you will get a list of the available Docker versions. Now you can run the below command with the particular version of Docker that you want to install on your system:

sudo apt-get install docker-ce=[version]

For example:

sudo apt-get install docker-ce=[version]

Step 9 – Checking the running Docker version

To confirm the installed version of the Docker on your system, run the following command:

sudo systemctl status docker

Step 10 – Starting the Docker version installed on your system

To start the installed version of the Docker on your system, run the following commands:

sudo systemctl start docker

sudo systemctl enable docker

Starting the Docker version installed on your system

Step 11 – Confirming the Docker’s version

Docker comes with a command that allows you to check and confirm the installed Docker’s version, this is:

docker –version

docker --version

Steps to Install Docker Using a .deb Package

To install the Docker manually, you can install it from the .deb file. Here’s how to do it:

  • Step 1 – Go to the Docker download page.
  • Step 2 – Navigate to pool -> stable -> amd64. This amd64 will indicate the stable Docker release for Ubuntu 18.04 version.

Install Docker Using a .deb Package

  • Step 3 – Once you select the Docker engine, the .deb package will get downloaded automatically. Make sure you save the path of the file downloaded.
  • Step 4 – The below command allows you to download and start the Docker installer:

sudo dpkg -i /path/to/docker.package.deb

Once you run the aforementioned command, the installer will start the process of installing Docker on your system with Ubuntu.

Install Docker With the Help of a Convenience Script

You can also install the testing version of Docker using a convenience script. This installation method, however, will not work if you are working in the production environment or if you already have Docker installed on your system.

Check and confirm the script before you download and run it. Once you get the script from the above-mentioned link, run the following command:

curl -fsSL https://get.docker.com -o get-docker.sh

Run the following command to start the installation process of Docker:

sh get-docker.sh

Running the Docker Commands without Sudo Access

You can work with the root user or the Docker group user to run the terminal Docker commands. While installing, the group user will be created automatically. If you run the command without using the sudo access or the group user, you will get the below output, for instance:

docker container run hello-world

docker container run hello-world

You will get the error unable to find the image. You have to add the working user to the Docker group to avoid the error. You can add the user by running the below command:

sudo usermod -aG docker ${USER}

You have to logout and then login back again to allow the changes to take effect.

Start the Docker on your System

Once you are done with the Docker installation, you should now check running the test image using the below command:

sudo docker run hello-world

As you install Docker, you will have some images on your Docker repository. You can check the available Docker images using the below commands:

sudo docker search [search_query]

sudo docker search ubuntu

sudo docker search ubuntuWith the help of the above command, you can search for a particular image present in the Docker hub. It will display the list of all the Docker images that match the provided image string.

Docker comes with a command that helps you to pull the image to your local machine. You can run the following command that will specify the image name, and the latest image will get pulled, if available:

sudo docker pull ubuntu

sudo docker pull ubuntu

Once you have pulled the image, it will help you run the container with this command:

docker run ubuntu

There are several images available. To pull every image on your machine, you can run the following command:

sudo docker images

Conclusion

Now you will be able to successfully install and run Docker on your system. With this blogpost, you get to know some essential Docker commands working with images. After reading it, you can easily install Docker on your Linux distribution, which, in this case, is Ubuntu 18.04.

If you have a basic knowledge of the command-line, you will get through the Docker installation instructions easily without making a considerable effort. Post Docker installation, you can get started with creating and deploying Docker applications. All the best!

Read more
corporate-one-light
+1 800 622 22 02
info@scapeindustries.com

Company

Working hours

Mon-Tue

9:00 – 18:00

Friday

9:00 – 18:00

Sat-Sun

Closed

Contacts

3 New Orchard Road
Armonk, New York 10504-1522
United States
915-599-1900

© 2021 Kuberty.io by Kuberty.io