Summary of petit techniques for Linux commands

Introduction

I wanted to organize the petit techniques of Linux basic commands within myself.

Introduction of basic commands

1. Rename the mv command

Normal change method

$ mv samplefile testfile

Petit technique

$ mv {sample,test}file

2. How to create a serial number file

Normal creation method

$touch file1 file2 file3 file4 ・ ・ ・

Petit technique

$ touch file{0..100}

3. How to output output & error results to a file at the same time

Premise

Suppose you only have a samplefile in your current directory.

$ ls
samplefile
$ ls -l samplefile testfile > lsoutfile
ls: 'testfile'Cannot access:There is no such file or directory

Normal redirect

$ ls -l samplefile testfile > lsoutfile 2>&1
or
$ ls -l samplefile testfile 2> lsoutfile 1>&2

Petit technique

$ ls -l samplefile testfile &> lsoutfile

4. How to put the execution result of the date command at the end of the file name

Petit technique

$ touch samplefile`date +%Y%m%d`   # ``Is back quotes
or
$ touch samplefile$(date +%Y%m%d)

at the end

I don't think I have the chance to use it so much, but I've summarized it because there are also such things. I'm glad if you can use it as a reference.

Recommended Posts

Summary of petit techniques for Linux commands
[Linux] Summary of middleware version confirmation commands
Summary of useful techniques for Python Scrapy
[Linux] Review of commands for deploying on AWS
Summary of frequently used commands (with petit commentary)
Summary of Linux (UNIX) commands that appeared in Progate
Summary of useful tips for Linux terminals ☆ Updated daily
Summary of Linux distribution types
A brief summary of Linux antivirus software for individuals
A brief summary of Linux
Explanation of package tools and commands for Linux OS
Basic knowledge of Linux and basic commands
Convenient shortcut keys for Linux commands! !! !!
Frequently used Linux commands (for beginners)
[Must-see for beginners] Basics of Linux
List of frequently used Linux commands
[Anaconda3] Summary of frequently used commands
[For competition professionals] Summary of doubling
Linux commands
linux commands
Linux commands
Linux commands
Linux (for users and su / sudo commands)
[Linux] Review of frequently used basic commands 2
Summary of frequently used commands of django (beginner)
Summary of methods for automatically determining thresholds
Summary of frequently used commands in matplotlib
[Linux] List of Linux commands used in practice
Summary of various for statements in Python
Linux operation for beginners Basic command summary
[Linux] Review of frequently used basic commands
[Linux] Learn the basics of shell commands
[Python/Django] Summary of frequently used commands (4) -Part 2- <Production operation: Amazon EC2 (Amazon Linux 2)>
[Python/Django] Summary of frequently used commands (4) -Part 1- <Production operation: Amazon EC2 (Amazon Linux 2)>
[Python/Django] Summary of frequently used commands (3) <Operation of PostgreSQL>
Network Linux commands
Verbalize Linux commands
Summary of Java 11 release status of major Linux distributions
Linux Command Summary
New Linux commands! !!
Basic LINUX commands
pyenv for linux
Summary of linux command techniques that I knew when I was a fledgling engineer
Summary of frequently used Python arrays (for myself)
[Linux command] A memorandum of frequently used commands
[Python/Django] Summary of frequently used commands (2) <Installing packages>
Various Linux commands
Typical Linux commands (7)
[Linux] A list of Linux commands that beginners should know
Summary of python environment settings for myself [mac] [ubuntu]
Summary of tools for operating Windows GUI with Python
Summary of pre-processing practices for Python beginners (Pandas dataframe)
Techniques for understanding the basis of deep learning decisions
Separation summary of development environment by chroot of various Linux
[Linux] Basics of authority setting by chmod for beginners
Numerical summary of data
[Must-see for beginners] Basics of Linux
Try compiling Linux commands (cross-compilation practice)
Summary of petit techniques for Linux commands
Let's try Linux for the first time
[Linux] Review of commands for deploying on AWS
Summary of Tensorflow / Keras
[For memo] Linux Part 2
Frequently used linux commands
Meaning of Linux permissions