Linux x memo


echo Display a character string on the screen

Add to file with echo command $ echo Character string to be added >> File name

Output to a newly created file with the echo command $ echo string> filename

In case of double quotation mark "" ", the variable is expanded and displayed. $ echo "$DIR"

grep Search for strings in files grep {search regular expression} {filename}

-n Show line number grep -n "10-16 10:" system.log

less Display text files one screen at a time

head Output the first few lines of the log file and check the contents -n {number}: Specify the number of lines ex) head -n 1 system.log

cut Extract only the required fields -f Select field ex) To specify a third field -f3 -d Specify delimiter ex), -d for delimiter, ex) cut -d " " -f1 system.log ex) cut -d " " -f1 system.log | tail -200f

wc Count the number of lines, words, and bytes ex) wc system.log -> 99872 1233964 18467421 system.log Number of lines, number of words, number of bytes

find Get a list of files that contain the character string "○○" in the file name. ls [path of search target folder] | grep" [character string you want to search] "

A list of files that contain the string "○○" in the contents of the opened file. find [path of search target folder] -type f -print | xargs grep'[character string you want to search]' -type f Specify the type to search. Since the left is "f", normal files are targeted -print Standard output of search results

mkdir mkdir `date .+%Y'` mkdir `date '+%Y'`/`date '+%m%d'` -> System current date and time can be specified in the directory name

ps Check the process ps -ef | grep java -e Show all processes -f Show processes hierarchically

Get a list of files that contain the character string "○○" in the file name. ls [path of search target folder] | grep" [character string you want to search] "

find Search file You can use the -name wildcard to search by specifying only part of a file or directory name. -type f Search only for files. -type d Search for directories.

Search in file : / {Search string}

scp Basic usage

scp [option]Copy source Copy destination

option -r Recursively copy in directory -p Keep original file update time and mode

When specifying another remote server

account [email protected]:directory

Example: Move from server to local ~ / tmp

scp [email protected]:/home/user/file1 ~/tmp

curl GET

curl {Host}

# +params
curl {Host}?{name}={value}&{name}={value}


curl -X POST {Host}

# +params
curl -X POST {Host} -d {name}={value}&{name}={value}
Output HTTP header
#Include HTTP headers in output
curl -i {Host}
#Get only HTTP headers
curl -I {Host}
Specify request header
curl -H "key:value"

#Multiple designation
curl -H "key:value" -H "key:value"
e.g. curl -X POST -H "Content-Type: application/json" -d '{"name":"tanaka"}' https://xxxxx
Display request headers and response headers
curl -v {Host}
Specify user agent
curl -A {User agent} {Host}
curl -H "User-Agent: xxx" {Host}
Use of proxy server
curl -x proxy server:port number{Host}

#If authentication is required
curl -x proxy server:port number--proxy-user username:Password http://Target URL

Line breaks (not limited to curl)

curl -s -X POST {url} \
    -H "accept: application/json" \
    -H "toke: *****"


Title URL
Frequently used curl command options
Hit the api with the curl command
14 ways to remember with the Curl command
Summary of frequently used curl command options (14)


Bash settings are required when using non-Linux commands Need to add settings to /home/jlguser/.bashrc Example) payara

export PAYARA_BIN=/usr/local/payara/glassfish/bin

Example) java

export JAVA_HOME=/usr/local/jdk1.8
export PATH=$JAVA_HOME/bin:$PATH

Articles that I learned

Title URL
.bash_profile ? .bashrc ?There are various things, where and what?
.bash_profile and.A prescription for you who can't remember the difference in bashrc
[Linux command collection] Summary including Linux command details
graceful should be used rather than restart to restart apache

Recommended Posts

Linux x memo
linux (ubuntu) memo
Linux # Command Memo 1
Linux kernel release 5.x (2/4)
Linux standard textbook memo 1
Linux standard textbook memo 3
[For memo] Linux Part 2
Linux kernel release 5.x (3/4)
Linux kernel release 5.x (4/4)
Linux kernel release 5.x (1/4)
NTP configuration memo on Linux
Linux standard textbook memo 1 part 2
Linux tar xz command memo
Memo on Mac OS X
Linux standard textbook memo part 6
Python memo Anaconda x Jupyter Notebook
Linux Frequently Used Commands [Personal Memo]
[For memo] Linux Part 1 vi editor
Install tensorflow in Docker (LINUX) (memo)
Linux command [ldconfig] LPIC learning memo
GitHub x Python development preparation memo
[Reading memo] Linux standard textbook (Chapter 7-8)
Linux command (basic in basic) personal memo
gzip memo
Raspberry-pi memo
Pandas memo
linux memorandum
Linux command # 4
Linux commands
Linux commands
Linux command # 3
Linux overview
HackerRank memo
Linux basics
Python memo
direnv (linux)
[Reading memo] Linux standard textbook (Chapter 1 to Chapter 6)
python memo
Organize Linux
graphene memo
Flask memo
pyenv memo
Matplotlib memo
linux commands
pytest memo
sed memo
Linux practice
Ubuntu Linux 20.04
X86 assembler on Linux (linkage with C)
Python memo
Install Memo
React → Ajax → Django on Linux implementation memo
BeautifulSoup4 memo
Linux Summary
networkx memo
Linux process
Linux permissions
python memo
Linux command # 5
tomcat memo