Linux-Bundle Flashcards

1
Q

Get help with Linux commands

A
  1. man <command> - Shows the manual for a command.
  2. <command> --help or <command> -h - Displays usage and options for a command.
  3. info <command> - Provides detailed information about a command.
  4. whatis <command> - Gives a brief description of a command.
  5. apropos <search-term> - Searches for commands related to a term.
  6. type <command> - Indicates if a command is built-in or external.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to check Linux Version?

A

Use the command lsb_release -a or cat /etc/os-release to check the Linux version.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do I see my command history on Linux?
How do I run a specific command from my command history?

A

To see your command history on Linux, type history in the terminal.

To run a specific command from your history, use ! followed by the command number from the history list. For example, !42 will run the 42nd command in your history.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the package manager used in Red Hat Enterprise Linux for installing and managing software?

A

Red Hat-based Systems (e.g., CentOS, Fedora)

yum list - List all available packages
yum install <package-name> - Install a package
yum update - Update all installed packages
yum remove <package-name> - Remove a package
  1. RPM (Red Hat Package Manager): Fundamental package management tool in all versions of Red Hat Enterprise Linux.
  2. YUM (Yellowdog Updater Modified): Primary package manager for Red Hat Enterprise Linux 7 and earlier versions, serving as a front-end to RPM.
  3. DNF (Dandified YUM): Enhanced package manager used in Red Hat Enterprise Linux 8 and later, acting as a more efficient front-end to RPM.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the package manager used in ubuntu Linux for installing and managing software?

A

Ubuntu (Debian-based Systems)

apt list - List all available packages
apt install <package-name> - Install a package
apt update - Update all installed packages
apt remove <package-name> - Remove a package
  1. APT (Advanced Package Tool): The primary and most commonly used package manager in Ubuntu, handling .deb packages and repositories.
  2. DPKG: The low-level tool that apt relies on to manage .deb packages. It handles package installation, removal, and information.
  3. Snap: A newer package management system developed by Canonical, the company behind Ubuntu. It’s used to install and manage Snap packages, which are self-contained and work across different Linux distributions.
  4. Software Center: A user-friendly graphical interface for managing software, which internally uses apt or Snap depending on the type of package.
  5. Synaptic Package Manager: A graphical package management program for apt. It provides a GUI for the apt-get command line utility.
  6. GDebi: A simple tool to install .deb files, which also resolves and installs their dependencies.
  7. Aptitude: Another front-end for apt, available as a command-line tool and offering a text-based interface.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do I identify built-in and external commands in Linux, Redhat, and Ubuntu?

A

To identify built-in and external commands in Linux, Redhat, and Ubuntu, you can use the following commands:

type <command_name></command_name>

or,

which <command_name></command_name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do I download a package from online in Linux?

A

There are two ways to download a package from online in Linux:

Using the wget command
Using the curl command

The wget command is a command-line utility that can be used to download files from the internet. To download a package using wget, you can use the following command:

wget <URL></URL>

The curl command is another command-line utility that can be used to download files from the internet. To download a package using curl, you can use the following command:

curl -o <path> <URL></URL></path>

For example, to download the vim package from the Ubuntu repositories and save it to the /tmp directory, you would use the following command:

curl -o /tmp/vim https://packages.ubuntu.com/impish/vim

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the advantages of using wget or curl to download packages?

What are the disadvantages of using wget or curl to download packages?

A

There are several advantages to using wget or curl to download packages:

-They are both very reliable and can download files even if there are network errors.

-They can download files from any website, not just from repositories.

-They can download files in parallel, which can speed up the download process.

-They can resume downloads if they are interrupted by a network error.

There are a few disadvantages to using wget or curl to download packages:

-They can be more difficult to use than graphical package managers.

-They do not provide any feedback on the download progress.

-They cannot install packages automatically.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Check local and public ip address?

A

You can use the ip addr show command to display all of the network interfaces on your system, along with their IP addresses. To find your local IP address, look for the IP address that is assigned to the interface that you are using to connect to your local network.

To find your public IP address, you can use the curl ifconfig.me command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Use cases for curl ?

A

Testing APIs: curl is often used to test and interact with APIs. You can make HTTP requests to different endpoints, inspect response headers and data, and verify API behavior.

Automating Tasks: curl can be utilized in shell scripts or automation workflows to perform various tasks, such as downloading files, fetching data from web services, or interacting with remote systems.

Debugging Network Issues: When troubleshooting network-related problems, curl can be used to check connectivity, test DNS resolution, verify SSL certificates, and examine HTTP response codes.

Uploading Files: curl enables you to upload files to remote servers using protocols like FTP, SCP, or HTTP. This is useful for automating file transfers or deploying files to a web server.

Downloading Files: You can download files from the web using curl, allowing you to retrieve specific resources or automate file downloads in scripts or scheduled tasks.

Scraping Web Content: curl can be combined with other tools like grep, awk, or sed to scrape web content or extract specific data from HTML pages. This can be useful for web scraping or data extraction tasks.

Testing Website Availability: By making HTTP requests to a website using curl, you can monitor its availability and response times. This can be done periodically as part of a monitoring system.

Authentication and Authorization: curl supports various authentication mechanisms, such as Basic, Digest, or OAuth. It can be used to test and verify authentication flows or interact with protected resources.

Simulating User Interaction: With curl, you can simulate user interactions by submitting form data, sending cookies, or handling sessions. This can be useful for testing web applications or replicating user behavior.

Integration with Other Tools: curl can be integrated with other command-line tools and utilities, allowing you to pipe data between commands or combine its functionality with other Linux tools for complex tasks.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to check all listening port on linux server?

A

Using netstat

The netstat command is a powerful tool that can be used to display information about network connections. To list all listening ports, use the following command:

netstat -an | grep LISTEN

Using ss

The ss command is a newer alternative to netstat. It offers a number of advantages over netstat, including the ability to display more detailed information about network connections. To list all listening ports, use the following command:

ss -an | grep LISTEN

Using nmap

The nmap command is a network scanner that can be used to scan a system for open ports. To list all listening ports, use the following command:

nmap -v -sT localhost

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Telnet network protocol

A

The telnet command is a network protocol that allows you to connect to a remote computer and interact with it as if you were sitting at the keyboard. It uses port 23 to establish a connection, and provides a way to manage remote systems using the CLI.

telnet [options] hostname [port]

telnet 192.168.1.122 80

USE CASES

Troubleshooting network problems: Telnet can be used to connect to a remote computer and check for connectivity issues. For example, you could use telnet to check if a particular port is open, or to see if a remote server is responding to requests.

Administering servers: Telnet can be used to administer remote servers, such as configuring settings, installing software, and troubleshooting problems.

Transferring files: Telnet can be used to transfer files between two computers. For example, you could use telnet to copy a file from a remote server to your local machine, or to upload a file from your local machine to a remote server.

Testing web applications: Telnet can be used to test web applications by connecting to the application’s port and interacting with it as a user. This can be useful for checking for errors, or for testing the application’s functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

You can use the service or systemctl command to check the status of a service on Linux.

A

service <service_name> status
systemctl status <service_name></service_name></service_name>

For More Info Use; man service or man systemctl

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Services

A

service <name> status --- To check the status of the servic</name>

service - This controls the starting and stopping of services

chkconfig - This controls which services are set to start on boot

#service <name> start ---To start the service
#service <name> stop --- To stop a service
#service <name> reload --- To reload the service #service <name> restart To restart the service</name></name></name></name>

#chkconfig <service> on --- To make the service available after restart #chkconfig <service> off --- To make the service unavailable after restart</service></service>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is demon in LINUX?

A

In Linux, a daemon is a program that runs in the background, without any user interaction. Daemons are typically used to provide services to other programs or users, such as serving web pages, managing network traffic, or providing file storage.

Some common examples of daemons include:

Apache: A web server daemon that serves web pages to users.
Samba: A file server daemon that allows users to share files and printers across a network.
MySQL: A database server daemon that stores and retrieves data.
SSH: A secure shell daemon that allows users to log in to remote systems securely.

Daemons are an essential part of the Linux operating system. They provide a wide range of services that make it possible for users to do their work and enjoy the benefits of a networked computer.

Here are some additional details about daemons:

Daemons typically have a name that ends with the letter "d". For example, the Apache web server daemon is called "httpd".
Daemons run in the background, without any user interaction. This means that they do not have a user interface, and they cannot be controlled by the user.
Daemons are typically started by the init system. The init system is a program that is responsible for starting and stopping all of the programs on the system.
Daemons are typically written in a programming language such as C or Python.
Daemons are often designed to be very efficient, so that they can use as few resources as possible.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what does chkconfig do?

A

Chkconfig is a command-line utility that allows you to manage the startup and shutdown of services on Linux systems. It can be used to enable, disable, start, stop, and restart services. Chkconfig also allows you to specify the runlevel in which a service should start or stop.

chkconfig [options] service [on|off|start|stop|restart]

Example:
chkconfig httpd on 2345
chkconfig smb stop
chkconfig mysql restart

Chkconfig is a powerful tool that can be used to manage the startup and shutdown of services on Linux systems. It is a valuable tool for system administrators who need to control how services are started and stopped on their systems.

Here are some additional things to keep in mind when using chkconfig:

You must be root to use chkconfig.
Chkconfig only works with services that are configured to start or stop at boot.
Chkconfig does not work with services that are started or stopped manually.
If you make a change to the startup configuration of a service with chkconfig, you may need to restart the service for the change to take effect.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

what is process management in linux?

A

Process management in Linux is the system of managing the execution of processes on a Linux system. It includes the creation, termination, and scheduling of processes, as well as the monitoring of their resources and performance.

The Linux kernel manages processes using a variety of methods, including:

Process ID (PID): Each process is assigned a unique PID, which is used to identify the process throughout its lifetime.
Process state: The state of a process can be one of the following: running, waiting, or terminated.
Process priority: The priority of a process determines how it is scheduled by the kernel.
Process resources: Each process has a number of resources associated with it, such as memory, CPU time, and I/O bandwidth.

The Linux kernel uses a variety of algorithms to schedule processes, including:

First-come, first-served (FCFS): The process that has been waiting the longest is scheduled first.
Round-robin (RR): Each process is given a slice of time to run, and then the next process is scheduled.
Priority-based scheduling: Processes with higher priority are scheduled more often than processes with lower priority.

The Linux kernel also provides a number of tools for monitoring and managing processes, including:

ps: The ps command displays a list of all processes on the system.
top: The top command displays a real-time list of all processes on the system, including their CPU usage, memory usage, and I/O bandwidth.
kill: The kill command sends a signal to a process, which can be used to terminate the process, suspend the process, or send the process a custom signal.
18
Q

What are hard and soft links in Linux?

A

A hard link is a mirror copy of the original file, while a soft link (or symbolic link) is a shortcut to the original file.

19
Q

How do you find a specific file in Linux?

A

Using the find or locate commands.

20
Q

How do you monitor system performance in Linux?

A

Using tools like top, htop, vmstat, iostat, etc.

21
Q

What is a DNS server and how is it configured in Linux?

A

A DNS server translates domain names into IP addresses. It’s configured in /etc/resolv.conf

22
Q

How do you configure a static IP address in Linux?

A

By editing network configuration files like /etc/network/interfaces or using nmcli in NetworkManager-based systems.

23
Q

What is a daemon in Linux?

A

A background process running continuously and performing specific operations like networking, printing, etc.

24
Q

What is the difference between Linux and Unix?

A

Linux is an open-source version of the Unix operating system. While Unix is older and proprietary, Linux is free and open-source, and has a wider range of distributions.

25
Q

What is a Linux Kernel?

A

The Linux kernel is the core part of Linux, responsible for managing the system’s resources, such as hardware and software communication.

26
Q

Explain the file system hierarchy in Linux.

A

Linux has a hierarchical file system structure with the root (/) directory at the base. Under root, there are several standard directories like /bin, /boot, /dev, /etc, /home, /lib, /mnt, /proc, /usr, and /var

27
Q

Explain file permissions in Linux.

A

File permissions in Linux are based on three types of users: owner, group, and others. Permissions define who can read, write, or execute the file.

28
Q

What does a Linux system administrator do?

A

A Linux system administrator manages the installation, maintenance, and operation of Linux servers and systems, including user management, software updates, system security, and troubleshooting.

29
Q

What is SSH and how do you use it?

A

SSH, or Secure Shell, is a protocol for secure remote login. You use it via the ssh command followed by a username and IP address or hostname to connect to a remote machine.

30
Q

Explain the purpose of the /etc/hosts file.

A

The /etc/hosts file is used to map hostnames to IP addresses. It’s a local source for hostname resolving.

31
Q

What is a DNS server and how is it configured in Linux?

A

A DNS (Domain Name System) server translates domain names into IP addresses. It’s configured in the /etc/resolv.conf file.

32
Q

How do you view active network connections?

A

You can view active network connections using commands like netstat, ss, or lsof.

33
Q

What are firewall rules in Linux?

A

Firewall rules in Linux are used to control the flow of network traffic. Tools like iptables or firewalld are used to set up these rules.

34
Q

How do you set up a basic iptables firewall?

A

You set up a basic iptables firewall by defining rules using the iptables command. These rules specify which traffic is allowed or blocked based on criteria like IP address, port number, and protocol.

35
Q

What is SELinux?

A

SELinux (Security-Enhanced Linux) is a security feature of the Linux kernel that provides a mechanism for supporting access control security policies.

36
Q

How do you check for listening ports in Linux?

A

You can check for listening ports using commands like netstat -tulnp or ss -tuln.

37
Q

Explain the role of TCP Wrappers in Linux.

A

TCP Wrappers provide an additional layer of network security, allowing control over incoming connections to various services.

38
Q

How do you monitor system performance in Linux?

A

System performance can be monitored using tools like top, htop, vmstat, and iostat.

39
Q

What is a load average and how do you interpret it?

A

Load average represents the average system load over a period. It’s a measure of the number of active tasks – processes that are either running or waiting for CPU time.

40
Q

How do you check disk space usage?

A

Disk space usage can be checked using the df command for disk filesystems and du for directory space usage.