Home Common Linux Commands
Post
Cancel

Common Linux Commands

Understand a Command

  1. $ man command for manual pages
  2. $ command --help for help

Run at Background

The screen command launches a terminal in the background which can be detached from and then reconnected to. You can start a screen, kick off a command, detach from the screen, and log out. You can then log in later and reattach to the screen and see the program running.

  • startup
    $ screen -S XXX.py
  • detach
    Ctrl + a + d

  • reattach
    $ screen -r

from https://access.redhat.com/articles/5247


Monitor Resources


Rename files in batches

$ rename [options] "s/oldname/newname/" file

Command rename’s options and parameters:

rename result
-n preview result without execute
(directly execute if without option [-n])
s stands for ‘substitution’
[()] Represents matching the content in []
// The empty space between the two slashes means replacing the empty content, equivalent to deleting
g means all matches, only one bracket will be matched by default if without it
^- add characters at the beginning of the file name

Other rules:https://www.cnblogs.com/mianbaoshu/p/11772876.html
Perl regular expressions:https://perldoc.perl.org/perlre


This post is licensed under CC BY 4.0 by the author.