Introduction to Linux Commands ~ LS-DYNA Edition ~

Here are the commands I often use when editing and executing LS-DYNA files on a Linux cluster.

table of contents

  1. Check for updated files
  2. Reuse of past commands
  3. Search for LS-DYNA errors
  4. Find out which file contains a word (#4-contactという単語がどのkeyファイルに含まれるかの検索)
  5. Linux key binding (shortcut key)
  6. Others (chmod/touch/mkdir/cp/mv/vi)

1. Check for update files

ls -trl  

--Displays the file update history line by line in long format so that ** the bottom is the latest history **. --When turning LS_DYNA, this command checks whether the glstat, binout, and d3plot files have been updated, and confirms that the analysis has started.

[Supplement] -l: Show files line by line in long format -r: Display in reverse order -t: Show files in update order (top of list is latest-> -r to bottom of list to latest file)

--It is convenient to register alias lt ='ls -trl' in .bashrc. You can do the same with lt as ls -trl --For aliases, I referred to @ _ydah's article. [Linux] Alias ​​setting method

(Bonus) Frequently used ls command options

---F: Display file type --File directories are displayed with a symbol after the directory, such as dir / run @ exe *.

symbol meaning
/ directory
@ Symbolic link
* Executable file
(Files with executable permissions)
No sign Normal file

---a: Show all files including hidden files

2. Reuse of past commands

history | grep hogehoge

--The above displays a history list of past commands including * hogehoge * --I often use the cluster I'm using because it has long commands like qsub -W denendancy = any: hogehoge and I can't remember it.

After the above command, in the history list

>594: qsub -W hogehoge

Is displayed. After that, you can execute the command by typing the command as shown below.

!594

3. Search for LS-DYNA errors

grep -i error mes* log

--If the mes * and log files contain the word "error" (case insensitive), display the file name.

-i: Case insensitive *: Wildcard

tail -n 15 mes* log d3hsp| less

-* mes \ * log d3hps * Look at the last 15 lines of the file and show it to less

4. Search for which key file contains the word contact

find . -name ".key"
grep -i *contact '!!'

The first command gets a list of * .key * files in the current directory ** and below **. The second command returns the part of the file list obtained in the first that contains the word "contact". '!!' refers to the previous command.

Maybe you can do the same with the command below.

find . -name "*.key" | xargs grep -l -i 'contact'

5. Linux key binding

--ctrl + a: Move cursor to the beginning of the current command --ctrl + k: Delete after from the current cursor position (blinking part) --ctrl + a-> ctrl + k to erase all currently written commands --ctrl + d: Delete the character at the current cursor position --ctrl + l: Organize terminal display --The current command line has moved to the top of the terminal.

6. Other commonly used commands

permission

-- chmod 777 MPP.sh: Grant permissions to MPP.sh (execute / write / read)

File creation

--touch d3kil: Create an empty file d3kil in the current directory (cd) --mkdir TEST: Create TEST directory on cd --cp -r hogedir hogedir2: Copy the entire contents of the directory with hogedir as hogedir2

File editing

--mv log log_old: Rename log file (without extension) to log_old -- vi fugafuga.key: Open fugafuga.key with vim --The vim commands are summarized in This article ~ vim command memorandum ~.

Recommended Posts

Introduction to Linux Commands ~ LS-DYNA Edition ~
[Linux] Introduction to Linux
Linux commands to remember
A super introduction to Linux
Linux commands
Linux commands
Introduction to TensorFlow --Hello World Edition
linux commands
Road to Linux Intermediate: Network Edition
Introduction to python-Environmental preparation (mac edition)
Linux commands related to character code
Introduction to Deep Learning ~ Dropout Edition ~
Linux commands
Linux commands
About Linux commands Super basic edition
Introduction to Python Django (2) Mac Edition
Introduction to Machine Learning-Hard Margin SVM Edition-
Introduction to MQTT (Introduction)
Introduction to Scrapy (1)
Introduction to Scrapy (3)
Introduction to Supervisor
Introduction to Tkinter 1: Introduction
Network Linux commands
Verbalize Linux commands
Introduction to PyQt
Introduction to Scrapy (2)
Linux user commands
New Linux commands! !!
Basic LINUX commands
Introduction to Scrapy (4)
Introduction to discord.py (2)
Various Linux commands
Introduction to discord.py
Typical Linux commands (7)
How to handle Linux commands well from Python
Beginners! Basic Linux commands and how to use them!
Frequently used Linux commands
Introduction to Lightning pytorch
Frequently used Linux commands
Introduce serverspec to Linux
Introduction to Web Scraping
Introduction to Nonparametric Bayes
Frequently used linux commands
Introduction to EV3 / MicroPython
Introduction to Python language
[Linux] Group related commands
Introduction to TensorFlow-Image Recognition
Introduction to OpenCV (python)-(2)
New Linux commands! !! Part 2
Introduction to PyQt4 Part 1
Introduction to Dependency Injection
Introduction to Private Chainer
What I did to get started with Linux commands
Introduction to machine learning
How to use linux commands in Visual Studio Code terminal
How to make a hacking lab-Kali Linux (2020.1) VirtualBox 64-bit edition-
20200329_Introduction to Data Analysis with Python Second Edition Personal Summary
Commands and files to check the version of CentOS Linux
Introduction to Socket API Learned in C Part 2 Client Edition
AOJ Introduction to Programming Topic # 1, Topic # 2, Topic # 3, Topic # 4
Introduction to electronic paper modules