Enable windows:
windows - start - features - turn windows fratures on or off
on - virtual machine platform
on - windows subsystem for linux
Restart
window's CLI commends :
wsl --install - i Ubuntu
usname - Ubuntu
passw - ubuntu Default
pwd - /home/ubuntu - home path/username
path - username rendum serinthu dhan home.
uname -a os version
whoami - username
clear CLI :
clear
ctrl+L
history - commends history
mkdir Dummy - create folder
mkdir -p dir1/dir2/dir3 - sup folders
vi Editor :
vi sample.txt
i -insert mood
Escape
:wq - save/quit
:q - quit
:q! - not save
dd - delete
ctrl+ shift + c -copy
ctrl+ shift + v - paste
press d two times helloworld - delete line
sudo apt-get install vim - updrade vim
vim Editor:
vim sample.txt
i - insert
enter - next line
Escape
:wq - save/quit
:q - quit
:q! - not save
: set number - 1 a 2 b 3c
/git - search word
nano Editor :
ctrl + x - save
y - yes
ctrl + x Exit
touch sample.txt - create file
rm sample.txt - remove file
rm txt - remove .txt files
rm - delete all files
ls txt - list .txt files
ls he - list start file name like he
cat sample.txt view content
cat sample.txt >> s1 copy file - append
cat/home/ubuntu/data.log - absl path
cp sample.txt s1.txt old file / copy file
mv sample.txt s1 rename file/ rename
mv .sl hidden file
mv .s1 s1 remove hidden
echo "Hello world " print cli
echo "Hello world " >>sample.txt create file or append mention file
history >> history.txt create file cp commends
ls - list files,file,dir
ls -l long list
ls -a - hidden files and dir
ls -s -sort
ls -r - reverse order
ls -t - time
ls *py - list emd match files
ls file - list start match file
ls
ls -lstr
ls .py - select .py file
ls time - start file
cd - current dir home
cd . - current dir
cd .. last dir
cd ~ home dir
cd - previous dir
cd ../.. - 2 dir back vara
vi .bashrc
source .bashrc - file execute
.bashrc - set Environment variables or program home
set program files home next execute .bashrc file
important:
hard link and soft link
hard link :
ln original.txt hard.txt
soft link :
ln -s original.txt soft.txt
alias p="pwd" short cut
schedule tasks:
2 clicks code run
monitoring live logs:
three type monitoring
top - task manager
ps
ps -aux - runining files
ps -aux | grep data_preocessing.py - particular file
ctrl + z -exit
cat data_process.log - viwe list log
tail -f data_process show live log
tail -10 data_process show live log last 10 lines
kill -9 168858 - force kill
particular file log
download links files images :
wget "http://img" - download
Disk:
df -h Disk free space
du -sh scripts file Disk usage
free -m free memory
free -g ram usages
remove cache :
sudo sh βc "sync; echo 3 >/proc/sys/vm/drop_caches"
zip and tar :
zip f1.zip scripts zip new folder name/zip folder
zip -r f1.zip scripts
ls -lstr | tail -f
unzip f1.zip
tar:
tar -czvf sample.tar scripts/
compress
z - tar type files force
details
verbose - list files
following list
untar :
tar -zxvf sample.tar scripts/
x -extract
z - tar type files force
details
verbose - list files
following list
word count :
wc -w sample.txt - words
wc -l sample.txt - lines
wc -c sample.txt - characters count
order :
sort file1
sort -r file1
sort numbers :
sort -n file1
head :
head sample.txt 1st 10 lines
head -n 5 sample.txt
tail :
tail sample.txt last 10 lines
tail -n 5 sample.txt
grep : search
grep ERROR log1.txt list matching lines
grep -i error log1.txt list -i upper or lower matching lines
grep -v error log1.txt ignore error and list other ines
grep WARRING *.txt global search
grep WARRING *.txt | tail -f
Network commends :
SSH - same network laa connect aa irukka ..en lap friend laptop connect pannalam
SCP - company server oda connrct panna .. ip add ,passw set pani work pannanum server laa
ifconfig - ip address
ssh :
ssh anoter way
2.30
tools:
putty ssh
winscp scp
find :
find . -name log.txt
find . -name ".txt"
find . βtype f βsize +10M 10mb mela
find . βmtime -1 1 day modification files
find . -empty
find . -name ".tmp" -delete
awk
group management
chomd 777 dummy -files
chomd -R 777 dummy -directory's
scheduling :
crontab -e
crontab formula:
crontab stands for "cron table". It's a file where you define tasks to run automatically at a set time or date.
π Cron = scheduler
π Crontab = list of scheduled tasks
π§ Basic Crontab Command
Command Description
crontab -e Edit your crontab file
crontab -l List current cron jobs
crontab -r Remove all cron jobs
crontab -u username -l View cron for another user (root only)
Crontab Syntax
- * * * * command_to_run | | | | | | | | | βββββ Day of the week (0 - 6) [Sun=0] | | | ββββββββ Month (1 - 12) | | βββββββββββ Day of the month (1 - 31) | ββββββββββββββ Hour (0 - 23) βββββββββββββββββ Minute (0 - 59)
π Common Examples
Time Crontab Syntax Description
Every minute * * * * * Runs every minute
Every hour 0 * * * * Runs at minute 0 of every hour
Daily at 5am 0 5 * * * Runs at 5:00 AM every day
Every Monday at 3pm 0 15 * * 1 Runs at 3:00 PM on Mondays
On Jan 1st at midnight 0 0 1 1 * New Year execution
- * * * * echo "Hello from cron!" >> /home/user/cronlog.txt
corntab guru website
OFF
Top comments (0)