To edit a file in shell, hit
nano helloworld.sh
To save and get out of nano, hit CTR + X
and then hit Y
.
To run: bash helloworld.sh
or .\helloworld.sh
But first you need to give permission: chmod +x helloworld.sh
Basic commands for this lesson:
echo #to print a message or variable
chmod #to change permissions in files or directories
exit #to exit terminal or connection
read $name #for user input
name="assign text to a variable"
echo "It will use your variable here: $name"
To use an input directly from shell, like .\BestDay.sh eggs
, use $1
for the first parameter
recipe=$1
echo "Today I'm going to cook $recipe"
Basic commands for this lesson:
whoami #your username
date #current date and time
pwd #where in directory you are
echo $SHELL #your shell
echo $USER #your userid
echo $HOSTNAME #your hostname
To create a new variable name for your system:
$ bestteam="Corinthians"
$ echo $bestteam
That can be used in your script!
But that will be erased as soon as you restart your terminal. To make it permanent, you need to write into a file called .bashrc
. The .
means that the file is hidden. That's a script that will run every time the system logs in.
nano .bashrc
Add export bestteam="Corinthians"
at the end of the file and log out and log in.
echo $bestteam #will equals to Corinthians!
Basic commands
tree // shows the whole directory
mkdir // create a directory
Network commands
ipconfig
ipconfig /all
findstr
ipconfig /release
ipconfig /renew
ipconfig /displaydns
ipconfig /renew
clip
ipconfig /flushdns
nslookup
cls
getmac /v
Check Battery
powercfg /energy
powercfg /batteryreport
assoc
Is your computer slow?
chkdsk /f
chkdsk /r
sfc /scannnow
DISM /Online /Cleanup /CheckHealth
DISM /Online /Cleanup /ScanHealth
DISM /Online /Cleanup /RestoreHealth
tasklist
taskkill
netsh wlan show wlanreport
netsh interface show interface
netsh interface ip show address | findstr “IP Address”
netsh interface ip show dnsservers
netsh advfirewall set allprofiles state off
netsh advfirewall set allprofiles state on
ping
ping -t
tracert
tracert -d
netstat
netstat -af
netstat -o
netstat -e -t 5
route print
route add
route delete
shutdown /r /fw /f /t 0
chmod ugo+rwx foldername
- Article: Streamline your projects using Makefile
- Article: Understand Linux Load Averages and Monitor Performance of Linux
- Article: Command-line Tools can be 235x Faster than your Hadoop Cluster
- Calmcode: makefiles
- Calmcode: entr
- Codecademy: Learn the Command Line
- Datacamp: Introduction to Shell for Data Science
- Datacamp: Introduction to Bash Scripting
- Datacamp: Data Processing in Shell
- MIT: The Missing Semester of CS Education
- Lecture 1: Course Overview + The Shell (2020)
0:48:16
- Lecture 2: Shell Tools and Scripting (2020)
0:48:55
- Lecture 3: Editors (vim) (2020)
0:48:26
- Lecture 4: Data Wrangling (2020)
0:50:03
- Lecture 5: Command-line Environment (2020)
0:56:06
- Lecture 6: Version Control (git) (2020)
1:24:59
- Lecture 7: Debugging and Profiling (2020)
0:54:13
- Lecture 8: Metaprogramming (2020)
0:49:52
- Lecture 9: Security and Cryptography (2020)
1:00:59
- Lecture 10: Potpourri (2020)
0:57:54
- Lecture 11: Q&A (2020)
0:53:52
- Lecture 1: Course Overview + The Shell (2020)
- Thoughtbot: Mastering the Shell
- Thoughtbot: tmux
- Udacity: Linux Command Line Basics
- Udacity: Shell Workshop
- Udacity: Configuring Linux Web Servers
- Web Bos: Command Line Power User
- Youtube: GNU Parallel
- YouTube: you need to learn BASH Scripting RIGHT NOW!! // EP 1
- YouTube: BASH scripting will change your life
- YouTube: this BASH script will make you a MILLIONAIRE