basic commands | mac | windows |
---|---|---|
change directory | cd |
cd |
current directory | pwd |
cd |
list files | ls , ll |
dir |
list files info | ls -l |
dir |
view file content | cat filename |
type filename |
open site | open http://www.naver.com |
explorer http://www.naver.com |
edit file | nano filename |
notepad filename |
sed -n '3p' file
# Here's another:
head -n 3 file | tail -n 1
file -bi filename
lsof | wc -l
ls -il
find . -inum 782263 -exec rm -i {} \;
find . -type d -user nobody
find . -type l
lsof -t -i:3000
# pid
lsof -i tcp:3000
# process
열린 포트 확인
lsof -i -nP | grep LISTEN | awk '{print $(NF-1)" "$1}' | sort -u
*:27017 mongod
*:8082 node
# dest
nc -l -p 7555 > myfile.txt
# mac
nc -l 7555 > myfile.txt
# source
nc 172.31.95.135 7555 < myfile.txt
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
iconv -f euc-kr -t utf-8 kimchi.txt > kimchi_utf8.txt
mkdir utf8
for file in *.csv; do
iconv -f euc-kr -t utf-8 "$file" > "utf8/${file%.csv}.utf8.csv"
done
date '+%Y%m%d %H%M%S' # today
date -v-3d '+%Y%m%d %H%M%S' # 1 days before
# or
date -d "3days ago" '+%Y-%m-%d %H' # bash
# .bash_profile
export TZ='Asia/Seoul';
sudo cp -p /usr/share/zoneinfo/Asia/Seoul /etc/localtime
sudo service crond restart
vi /etc/sudoers
## Allows people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
%dev ALL=(ALL) ALL
sudo dnf install pciutils
lspci | grep -i vga
find . -type f | egrep "gif$|jpg$|jpeg$|svg$|png$|webp__html__quot; | wc -l
find . -type f | grep -v list_files |egrep "php$|html$|htm$|js$|css$|inc__html__quot; > list.txt
tar cvfz text.tgz -T list.txt
find . -type f | grep -v list_files |egrep "gif$|jpg$|jpeg$|svg$|png$|ico__html__quot; > list_img.txt
tar cvfz img.tgz -T list_img.txt
find . -name .DS_Store | xargs rm
# to handle spaces in filenames
find . -name .DS_Store -print0 | xargs -0 rm
ps -ef | grep httpd
ps x -o "%p %r %c"
ps -ef | grep httpd
kill -TERM -- -22590
pgrep -f java
sudo dnf -y install htop
htop
htop -p "$(pgrep -vfd, 'java|python')"
wget https://github.com/bootandy/dust/releases/download/v1.1.1/dust-v1.1.1-x86_64-unknown-linux-gnu.tar.gz
tar xvfz dust-v1.1.1-x86_64-unknown-linux-gnu.tar.gz
sudo mv dust-v1.1.1-x86_64-unknown-linux-gnu/dust /usr/local/bin
rm -rf dust-v1.1.1-x86_64-unknown-linux-gnu*
sudo dust /
dust -h
ls -la --time-style=full-iso
sudo dnf install sendmail -y
echo -e "Subject: Terminal Email Send\n\nEmail Content line 1\nEmail Content line 2" > content
sendmail recipient@example.com < content
mutt -s "subject" -i body.txt -a attachment.txt recipient@example.com
mail -s "This is the subject" kenu.heo@gmail.com <<< 'This is the message'