Chart type ruby-appendix-I (bash + emacs)

!Mac OS X-10.15.7!ruby-2.7.1p83

Intro

Purpose

If you can make full use of cui (character user interface), the work will be extremely fast. For example, it was convenient to look for something on a mac.

find . -name '*.key' | xargs open

Then, all the keynotes existing in the child directory will be opened. Knowing this, you can streamline not only text but also what you are looking for, including images.

Instead of thinking in opposition to CUI vs GUI, take the best of both worlds as CUI x GUI and dramatically increase your productivity.

The keys to improving efficiency are CoC (Convention over configuration, irreducible rather than configuration) and key-bind. If you can use key-bind (ctrl-c, ctrl-v, alt-TAB, alt-w) in GUI, you can increase your productivity.

For paste on ubuntu, Ctrl-shift v and right-click.

Editing the README.org

First, edit the README.org that you submitted last week to familiarize yourself with the operation of emacs.

The relevant part of README.org

#+AUTHOR: Shigeto R. Nishitani
#+name_list:27001234 Shigeto Nishitani
#+qiita_id: daddygongon
#+github_id: daddygongon

I have you correct it. Of course, the number, name, and id are my own. It is also a CoC to simplify the work after this.

shell [I] command basic

The shell is located outside the center of the operating system (kernel), and is responsible for the function of receiving keyboard input, passing it to the kernel, and outputting it to the screen with a good feeling. This is the name you gave. There are several derivations of shell. ubuntu uses bash (a shell that was reborn as a shell written by Bourne and was born again) by default, but fish and zsh are the current trends.

It is called a command line interface (cli) or character user interface (cui) because it throws commands to the shell and exchanges them.

command is

Or

That is the basic form. [] Means optional. There are two types of options: type the character (short option) after the - symbol, or type the full description (long option) after the --.

Please check. The manual of man is displayed. NAME, SYNOPISI, OPTION, etc. are displayed. The end is q (uit).

shell [II] directory related

First of all, it is a command related to directory (it may be easier to understand if it is called a folder). It is intended as a telephone directory (directory) for organizing files.

img
Fig.Directory structure and absolute path, relative path.

Something.

There are relative path and absolute path in directory path.

emacs

emacs is one of the high performance editors. Please read vi and code appropriately and use the familiar tools as they are.

emacs

――It was made to be convenient for editing remote files from a terminal comfortably in the old poor communication environment. ――Therefore, it is a major premise that you do not use a mouse at all. --Instead, key-bind is used for commands such as moving the cursor and saving files. ――This can be used in bash as it is, so if you remember it, the work speed will increase. --Vi is the same idea. Furthermore, vscode is now evolving by incorporating gui (graphical user interface). ――I'm left behind, --If you know the key operation of emacs, you can use it with vscode, ――Please remember that it is indispensable when operating the cloud environment remotely.

To describe the flow,

  1. emacs REDAME.org
  2. Some editing operation
  3. c-x c-s (save)
  4. c-x c-c (quit) or c-z(stop)

is. The difference between quit and stop will be explained in detail in the next section. In editing,

Is used a lot. Please refer to the cheat sheet below.

img
Fig.emacs key bind cheat sheet;The keybind character has the meaning of an instruction.

shell [III] process related

The commands provided as process-related operations are

Something.

Even if you stop with c-z with emacs and return to bash, you can see that emacs is working by ps or top. This means that emacs is in bg and fg will pass the operation from bash to emacs. When using emacs, a lot of emacs may be launched without noticing it. If you do so, the edited result may be lost. If you notice it, use kill to delete the process. When there are many, it is better to forcibly drop ubuntu and re-enter.

git

git is a backup software developed by Linus Torvalds, the creator of Linux. It can also be used for information sharing, and github provides the integrated service. The first required settings are as follows.

--git config --global core.editor emacs # vi or code is OK

To move the repository on github to local

will do.

img
Fig.Backup with git command. Here, only the inside of the red frame is used.

Daily work

is.

The main was named master until a while ago. If you get angry that you don't have it, change main to master and push and pull. Or,

Please check with.

Wildcard \ * and complements and pipes

The'\ *'(asterisk), which means'anything character', is useful.

There is more complement,

For example, it will autocomplete the characters below R with a nice feeling.

Furthermore, if you use a function called pipe, you can make the output of command the next input. That was shown at the beginning,

find . -name '*.key' | xargs open

is. find is a general-purpose instruction to find a file. If it is -name, you can specify the name, and you can also specify the change time. xargs takes the output and connects it to the input of the instruction.

Challenge [I]

For today's first task, make the necessary changes listed at the beginning of README.org and push to github.

If you are concerned about personal information, please send it by email.

Unloaded notes from next week onwards


Recommended Posts

Chart type ruby-appendix-I (bash + emacs)
Chart type Ruby
Chart type ruby-appendix-III (bundler)
Chart type ruby-I (puts)
Chart type ruby-appendix-IV (rake)
Chart type ruby-appendix-V (rubular)
Chart type 2nd summary
Chart type ruby-appendix-VI (thor, rubocop)