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 name@hostname:directory
Example: Move from 192.168.10.1 server to local ~ / tmp
scp [email protected]:/home/user/file1 ~/tmp
curl GET
curl {Host}
# +params
curl {Host}?{name}={value}&{name}={value}
POST
curl -X POST {Host}
# +params
curl -X POST {Host} -d {name}={value}&{name}={value}
#Include HTTP headers in output
curl -i {Host}
#Get only HTTP headers
curl -I {Host}
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
curl -v {Host}
curl -A {User agent} {Host}
curl -H "User-Agent: xxx" {Host}
curl -x proxy server:port number{Host}
#If authentication is required
curl -x proxy server:port number--proxy-user username:Password http://Target URL
\
e.g.
curl -s -X POST {url} \
-H "accept: application/json" \
-H "toke: *****"
reference
Title | URL |
---|---|
Frequently used curl command options | https://qiita.com/ryuichi1208/items/e4e1b27ff7d54a66dcd9 |
Hit the api with the curl command | https://qiita.com/bunty/items/758425773b2239feb9a7 |
14 ways to remember with the Curl command | https://orebibou.com/2016/03/curl%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%A7%E8%A6%9A%E3%81%88%E3%81%A6%E3%81%8A%E3%81%8D%E3%81%9F%E3%81%84%E4%BD%BF%E3%81%84%E6%96%B9xx%E5%80%8B/ |
Summary of frequently used curl command options (14) | https://qiita.com/shtnkgm/items/45b4cd274fa813d29539 |
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
export PATH=$PAYARA_BIN:$PATH
Example) java
export JAVA_HOME=/usr/local/jdk1.8
export PATH=$JAVA_HOME/bin:$PATH
Title | URL |
---|---|
.bash_profile ? .bashrc ?There are various things, where and what? | https://qiita.com/hirokishirai/items/5a529c8395c4b336bf31 |
.bash_profile and.A prescription for you who can't remember the difference in bashrc | http://dqn.sakusakutto.jp/2012/08/bash_profile_bashrc.html |
[Linux command collection] Summary including Linux command details | https://eng-entrance.com/category/linux/linux-command |
graceful should be used rather than restart to restart apache | http://www.wegirls.tech/entry/2016/09/23/215020 |
Recommended Posts