Summary of useful tips for Linux terminals ☆ Updated daily

Can't it be a Linux terminal? I made an article about the record that I googled

Even if I often google, there are many links that I forgot after all, and I feel the importance of recording and summarizing googles.

In the first place, there must have been a lot of sites full of tricks that were buried in the history without remembering "What kind of word did you google?", I will share it as an article so as not to forget it I will try.

Introduction of tricks

Get the log of the specified date and time from the log file

Original material is here

$ awk '/2014-01-01 21:/' log.txt; tail -f log.txt

List the users in the group

Original story is here

$ grep 'grpup-name-here' /etc/group

It is convenient to install a module called members

$ members ftponly

Parse all directories and list heavy files in the top 10

$ sudo ls -lhSR / | grep -v '^d' | head -10

Skip the CSV header row and list any columns

Referenced stackoverflow

** Extract the following CSV name column **

sample.csv


name,age
hoge,10
fuga,12
bar,14
# tail -n +2 $1 Skip the first line and display from the second line
$awk -F, '{ print $1 }' sample.csv | tail -n +2 $1

Show only the first 10 lines of the file

Original material is here

#10 lines
$ head -10 bar.txt
#20 lines
$ head -20 bar.txt

Recursively search for strings in folders

grep -r '[Character string]' /【Folder name】

Extract 3 fields from CSV and display the first 10 rows in descending order based on the value in the 3rd column

$ cut -d ',' -f 3,5,7 kawasaki_koukai.csv | sort -n -r -t ',' -k 3 | head -n 10

Change log

--2019/12/09 Created this article --2019/12/10 Added awk tricks --2020/1/19 Added cut and grep tricks

Recommended Posts

Summary of useful tips for Linux terminals ☆ Updated daily
Summary of petit techniques for Linux commands
Summary of useful techniques for Python Scrapy
A brief summary of Linux antivirus software for individuals
Summary of Linux distribution types
A brief summary of Linux
[Must-see for beginners] Basics of Linux
Summary of pages useful for studying the deep learning framework Chainer
[For competition professionals] Summary of doubling
A summary of Python e-books that are useful for free-to-read data analysis
Summary of methods for automatically determining thresholds
[Linux] Summary of middleware version confirmation commands
Windows → linux Tips for bringing in data
[Linux command summary] Command list [Must-see for beginners]
Summary of various for statements in Python
Linux operation for beginners Basic command summary
Summary of vtkThreshold (updated from time to time)
Linux Summary
[Linux] Review of commands for deploying on AWS
Summary of Java 11 release status of major Linux distributions
Summary of frequently used Python arrays (for myself)