The story of Linux that I want to teach myself half a year ago

Overview

Recently I started studying for LPIC Level 1. This time, I wrote on the theme that I wish I knew this half a year ago (4 months after joining the company).

Is Linux an OS?

Linux is often mentioned side by side with Windows and macOS, so at that time I thought it was one of the operating systems. Speaking of a strict definition, Linux is a kernel (the core part of the OS) in a narrow sense, and it is a part that plays a particularly important function for the OS such as memory management and input / output management. On the other hand, it may also refer to Linux as an OS in a broad sense. When you speak the word "Linux", you need to think about what you are referring to and what you are using. I have a feeling, but when the word "Linux" comes out, I feel that it is often used in the (broad sense) sense of the OS.

What is a Linux distribution

A Linux distribution is an operating system that has been made to behave like UNIX by adding libraries to Linux (kernel). Talking side by side with Windows and macOS refers to this Linux distribution. Typical examples are ** Red Hat-based distributions (CentOS, etc.) ** developed by Red Hat, and ** Debian-based distributions (ubuntu, etc.) ** developed by the Debian Project. Hereinafter, Linux distributions are collectively referred to as Linux OS.

When you can't remember a command or option

The operation of LinuxOS is basically CUI (Command Line Interface), and it is a little difficult for those who are accustomed to operation by GUI (Graphical User Interface) using a mouse or the like. For example, use the ** ls command ** to see a list of files in a directory. To work well with the Linux OS, you need to remember commands like ** ls ** and options to condition their behavior, but sometimes it's hard to remember. In such cases, the ** man ** command and ** --help ** option are useful.

$ man ls

NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

DESCRIPTION
       List  information  about the FILEs (the current directory by default).  Sort entries alphabetically if none of
       -cftuvSUX nor --sort is specified.

       Mandatory arguments to long options are mandatory for short options too.

       -a, --all
              do not ignore entries starting with .
(Omitted)
$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all                  do not ignore entries starting with .
  -A, --almost-all           do not list implied . and ..
      --author               with -l, print the author of each file
  -b, --escape               print C-style escapes for nongraphic characters
      --block-size=SIZE      with -l, scale sizes by SIZE when printing them;
                               e.g., '--block-size=M'; see SIZE format below
  -B, --ignore-backups       do not list implied entries ending with ~
  -c                         with -lt: sort by, and show, ctime (time of last
                               modification of file status information);
                               with -l: show ctime and sort by name;
                               otherwise: sort by ctime, newest first
  -C                         list entries by columns
      --color[=WHEN]         colorize the output; WHEN can be 'always' (default
                               if omitted), 'auto', or 'never'; more info below
  -d, --directory            list directories themselves, not their contents
  -D, --dired                generate output designed for Emacs' dired mode
  -f                         do not sort, enable -aU, disable -ls --color
  -F, --classify             append indicator (one of */=>@|) to entries
      --file-type            likewise, except do not append '*'
      --format=WORD          across -x, commas -m, horizontal -x, long -l,
                               single-column -1, verbose -l, vertical -C
      --full-time            like -l --time-style=full-iso
  -g                         like -l, but do not list owner
(Omitted)

Displays a description of the command specified by the ** man ** command or **-help ** option and the options of that command. Command names and options are often abbreviations for basically behavioral words. Rather than just remembering commands and options as strings, knowing their meaning makes them much easier to remember.

For example, the command to display the current working directory is the ** pwd ** command. If you just remember this as ** "pwd" ** or ** abbreviation for "print working directory" **, I think the latter is easy to remember.

The origin of the command is summarized on the here page for easy viewing.

alias

The ** -l ** option of the ** ls ** command is a very useful option that shows the permissions and owners of the files in the directory.

~/testdir# ls
test1.txt  test2.txt
~/testdir# ls -l
total 0
-rw-r--r-- 1 root root 0 Jan 14 22:10 test1.txt
-rw-r--r-- 1 root root 0 Jan 14 22:10 test2.txt

By adding aliases to frequently used commands like this, you can operate them more easily. To give an alias, use the ** alias ** command

~/testdir# alias ll='ls -l'
~/testdir# ll
total 0
-rw-r--r-- 1 root root 0 Jan 14 22:10 test1.txt
-rw-r--r-- 1 root root 0 Jan 14 22:10 test2.txt

File search

The ** locate ** command is useful for finding files

[root@6f07fde89980 testdir]# ls
testFile1.txt  testFile2.txt
[root@6f07fde89980 testdir]# locate testFile
/testdir/testFile1.txt
/testdir/testFile2.txt

There is a ** find ** command that shows similar behavior, but the ** locate ** command can search faster. This is because the ** find ** command searches for files in real time, while the ** locate ** command searches the DB where the file path is stored. Therefore, the ** locate ** command may not be able to search the file immediately after creation (file whose file path is not registered in the DB). To update the DB of the file path, use the ** updatedb ** command.

The locate command may not be installed pre-installed on the Linux OS It can be installed with the ** apt-get ** command on ubuntu and the ** yum ** command on centos.

# apt-get install mlocate
# yum install mlocate

Recommended Posts

The story of Linux that I want to teach myself half a year ago
The story of IPv6 address that I want to keep at a minimum
Convenient Linux keyboard operation that I want to teach myself when I was in school
A story that struggled to handle the Python package of PocketSphinx
I want to sort a list in the order of other lists
I want to identify the alert email. --Is that x a wildcard? ---
Python: I want to measure the processing time of a function neatly
I want to customize the appearance of zabbix
[For beginners] I want to get the index of an element that satisfies a certain conditional expression
[AtCoder for beginners] A story about the amount of calculation that you want to know very roughly
I want to set a life cycle in the task definition of ECS
I want to add silence to the beginning of a wav file for 1 second
I want to see a list of WebDAV files in the Requests module
I want to create a web application that uses League of Legends data ①
A story that reduces the effort of operation / maintenance
I want to grep the execution result of strace
I want to fully understand the basics of Bokeh
I want to install a package of Php Redis
A story that I was addicted to at np.where
A story that analyzed the delivery of Nico Nama.
I want to increase the security of ssh connections
I want to take a screenshot of the site on Docker using any font
I want to use a network defined by myself in PPO2 of Stable Baselines
I want to use Linux commands at the command prompt! Use Linux commands at the command prompt instead of Git Bash
I want to start a lot of processes from python
I want to use only the normalization process of SudachiPy
NikuGan ~ I want to see a lot of delicious meat! !!
I want to get the operation information of yahoo route
I made a function to check the model of DCGAN
I want to judge the authenticity of the elements of numpy array
I want to know the features of Python and pip
After all, the story of returning from Linux to Windows
Keras I want to get the output of any layer !!
I want to know the legend of the IT technology world
I want to create a Dockerfile for the time being.
[Python] I want to make a 3D scatter plot of the epicenter with Cartopy + Matplotlib!
I want to find a stock that will rise 5 minutes after the Nikkei Stock Average rises
I want to find the intersection of a Bezier curve and a straight line (Bezier Clipping method)
I want to output a beautifully customized heat map of the correlation matrix. matplotlib edition
A story about porting the code of "Try and understand how Linux works" to Rust
A story that I was addicted to calling Lambda from AWS Lambda.
I want to get the name of the function / method being executed
I want to record the execution time and keep a log.
The story that the version of python 3.7.7 was not adapted to Heroku
[Linux] I tried to summarize the command of resource confirmation system
I tried to make a site that makes it easy to see the update information of Azure
I want to manually assign the training parameters of the [Pytorch] model
[Linux] I want to know the date when the user logged in
[Introduction to StyleGAN] I played with "The Life of a Man" ♬
I want to output the beginning of the next month with Python
Qiskit: I want to create a circuit that creates arbitrary states! !!
I want to create a system to prevent forgetting to tighten the key 1
How to output the output result of the Linux man command to a file
The story of creating a site that lists the release dates of books
A story that is a little addicted to the authority of the directory specified by expdp (for beginners)
A story that didn't work when I tried to log in with the Python requests module
I made a slack bot that notifies me of the temperature
I want to check the position of my face with OpenCV!
[Twitter] I want to make the downloaded past tweets (of my account) into a beautiful CSV
I want to know the population of each country in the world.
I want to clear up the question of the "__init__" method and the "self" argument of a Python class.