sudo fdisk -l
or sudo lshw -C disk
sudo fdisk /dev/sd<?>
#0 stdin -> PROCESS -> #1 stdout, #2 stderr
stdin: input information. Also, <
define possible
stdout: normal output
stderr: error outputIn python, print("message", file = sys.stderr) (default: stdout)
program 1> result.txt 2> error.txt
pipe run1 | run2
run2 receiving run1’s result.
awk ‘{print $0}’ infile
Usage: sed [OPTION]… {script-only-if-no-other-script} [input-file]…
-n
, suppress automatic printing of pattern space
-e script
, add the script to the commands to be executed
-f script-file
, add the contents of script-file to the commands to be executed
-i[SUFFIX]
, edit files in place (makes backup if SUFFIX supplied)
-l N
, specify the desired line-wrap length for the `l’ command
-E, -r
, use extended regular expressions in the script
(for portability use POSIX -E).
-d
, delete, i.e. 3d, 3rd row’s deleted.
sed -i -e 's/abc/\x0/g' /tmp/file.txt # \x0?
sed -i '/abc/d; /XYZ/d' /tmp/file.txt # /tmp/file.txt에서 abc와 XYZ를 찾아 삭제한다.
default printing $rows, $words, $characters
-l
row
-w
word
-c
character
ImageMagick has some issue. inkscape -w 1024 -h 1024 input.svg --export-filename output.png
ref - https://stackoverflow.com/a/14174624/10103236
Tab
^C
: stop some progress^Z
: This shortcut will send a running program in the background.^D
: logout in ssh condition. exit in local condition.^L
: clear terminal screen^A
: This shortcut will move the cursor to the beginning of the line.^E
: This shortcut is sort of opposite to Ctrl+A.^U
: This shortcut erases everything from the current cursor position to the beginning of the line.^K
: it erases everything from the current cursor position to the end of the line.^W
: Using Ctrl+W shortcut, you can erase the word preceding to the cursor position.^Y
: This will paste the erased text that you saw with ^W, ^U and ^K shortcuts.^P
: You can use this shortcut to view the previous command.^N
: You can use this shortcut in conjugation with Ctrl+P. Ctrl+N displays the next command.^R
: search in command historyssh-keygen -p -f ~/.ssh/id_rsa
passphrase를 변경할 수 있다.ssh-copy-id <someonePC>
는 ~/.ssh/id_rsa.pub
가 <someonePC>:~/.ssh/authorized_keys
에 추가가 된다.
-a
: all information-r
: kernel release
#!/bin/bash
# Basic info
HOSTNAME=`uname -n`
ROOT1=`df -Ph | grep sdb1 | awk '{print $4}' | tr -d '\n'`
ROOT2=`df -Ph | grep sda1 | awk '{print $4}' | tr -d '\n'`
DATE=`date`
# System load
MEMORY1=`free -t -m | grep Total | awk '{print $3" MB";}'`
MEMORY2=`free -t -m | grep "Mem" | awk '{print $2" MB";}'`
LOAD1=`cat /proc/loadavg | awk {'print $1'}`
LOAD5=`cat /proc/loadavg | awk {'print $2'}`
LOAD15=`cat /proc/loadavg | awk {'print $3'}`
logo="
---
ABC
---
"
echo -e "\e[1;92m$logo\e[m"
echo -e "
\e[1;90m# info: ~ \e[0m"
echo "
=================================================
- Hostname............: $HOSTNAME
- Disk Space..........: $ROOT1 remaining (/home)
$ROOT2 remaining (/home2)
=================================================
- CPU usage...........: $LOAD1, $LOAD5, $LOAD15 (1, 5, 15 min)
- Memory used.........: $MEMORY1 / $MEMORY2
- Swap in use.........: `free -m | tail -n 1 | awk '{print $3}'` MB
=================================================
@ $DATE"
systemctl get-default
systemctl set-default [multi-user.target (runlevel 3)|graphical.target (runlevel 5)]
ldd -v /path/to/program/executable
to show you the shared libraries required by any given program