Skip to content

Instantly share code, notes, and snippets.

View howtouselinux's full-sized avatar

howtouselinux howtouselinux

View GitHub Profile
@howtouselinux
howtouselinux / linux-server.md
Last active December 18, 2022 03:21
step by step to troubleshooting linux server problems

If your linux server is running slowly, don’t worry – you’re not alone. This problem is very common, and there are a few things you can do to troubleshoot the issue. In this blog post, we will discuss four methods that you can use to speed up your linux server. We will also provide some tips for preventing future slowdowns. Let’s get started!

Check your Linux server’s load average in Linux

The first thing you should do when troubleshooting a slow linux server is to check the load average. The load average is a measure of how much processing power your server is using. If the load average is high, it means that your server is under a lot of stress and may be running slowly as a result.

There are a few ways to check the load average on your Linux server. One way is to use the top command. This will show you the curre

@howtouselinux
howtouselinux / interview.md
Last active December 18, 2022 04:13
top 15 Linux interview questions and answers

Top 15 Linux Interview Questions & Answers for Job Seekers

Do you know that more than 90% of the fastest computers in the world run on Linux? Linux is fast, strong, and a favourite among techies. If you want to become a Linux Administrator, this is the right place to prepare for the interview.

In this article, we have shared the 15 top Linux interview questions and answers that every job seeker should read.

Top 15 LINUX Interview Questions And Answers

@howtouselinux
howtouselinux / linux-users.md
Created December 18, 2022 07:40
How to manage users and groups in Linux

In every operating system, there are users and groups with unique names and unique IDs. These users have access, control and permissions to create and manipulate files, manage processes and services.

In linux, there are four types of users: use the $ cat /etc/groups to view all the users and user groups or $ sudo cat /etc/passwd to view the users and users groups in detail including the paths(directory) where their files are stored.

  • Root user

Root user is a default user automatically created upon the OS installation. The root user has the highest privileges, access to all files and services and can perform a wide range of functions. The default ID for every root user is 0. One of the ways to perform functions with administrative privileges is to initiate a command using $ sudo which means superuser do . You can equally enter into root with $ sudo -i. However, you need to provide the root password for authentication. Run $ sudo cat /etc/sudoers to view users

Below, you'll find a collection of Linux resources categorized into resource types - videos, books, sites, etc. I hope it will serve you well in your journey of becoming a Linux Master ;

Learn Linux Sites for Beginners

Apparently the stat utility only shows the creation time for files but leaves out the birth field empty for directories.

stat /path/somedir

reference: how to check file creation time in Linux

Output

du

Summarize disk usage of each FILE, recursively for directories sorted by size

sudo du -x -h / | sort -n | tail -40

reference: how to check file size in Linux

truncate

Truncate files to size 0MB

truncate -s 0 production.log
@howtouselinux
howtouselinux / check-ip-address-in-Linux.md
Created December 23, 2022 08:12
how to check ip address in Linux
@howtouselinux
howtouselinux / linux-commands-cheat-sheet.md
Created December 23, 2022 12:42
Linux commands cheat sheet

Reference: Linux commands cheat sheet

#Linux Cheat Sheet

##File Commands:

  • ls – directory listing
  • ls -al – formatted listing with hidden files
  • cd dir - change directory to dir
  • cd – change to home
  • pwd – show current directory
---
- name: Configure Users
hosts: localhost
gather_facts: no
tasks:
- name: Create dictionary of users
set_fact:
users:
user1:
name: jdoe
---
- name: Check if Variable is a Dictionary
hosts: localhost
gather_facts: no
vars:
var1:
key1: value1
key2: value2
var2: "Not a dictionary"
tasks: