Skip to content

Instantly share code, notes, and snippets.

@randallwc
Last active February 18, 2022 00:31
Show Gist options
  • Save randallwc/a91dfdbae55b98847361e1fec230df8f to your computer and use it in GitHub Desktop.
Save randallwc/a91dfdbae55b98847361e1fec230df8f to your computer and use it in GitHub Desktop.
Linux commands
# list files
ls
# change directory
cd [path]
# go to home directory
cd
cd ~
# go to root directory
cd /
# open in vim
vim [file name]
# delete file
rm [file name]
# delete folder [-r means recurse]
rm -r [folder name]
# how to rename and move
mv [original path] [dest path]
# to rename
mv [original name] [new name]
# shutdown
sudo shutdown -h now
# reboot
sudo reboot -h now
# how to update your system
sudo apt-get update
sudo apt-get upgrade
# install apps
sudo apt-get install [name of program]
sudo apt-get install git
# system info
uname
# see if wifi works
ping www.google.com
# look at wifi information
sudo ifconfig
# how to cancel commands
^c
# how to put a program into the background
^z
# how to bring it back from the background
fg
# see background tasks
jobs
# how to run something with python
python3 [name of the script]
python3 berryIMU.py
# how to install python packages
conda install [name of package]
conda install numpy
# if this doesnt work
pip intall [name of package]
# how to find where something is running from
which [name of command]
which ls
which mv
git help [name of git command]
git help status
git status
git pull
git fetch
git commit
git branch
git checkout
git push
git log
git log --oneline
git log --oneline --all --graph
git merge
git reset --soft
git reset --hard
git diff
git clone
git add [filename]
git add . # adds everything
git add -A # same thing
# how to execute files
chmod +x [script name]
./[script name]
# raspberry pi stuff
# setting page
sudo raspi-config
# imu setup
# clone the rep
wget https://github.com/jjhelmus/berryconda/releases/download/v2.0.0/Berryconda3-2.0.0-Linux-armv6l.sh
chmod +x Berryconda3-2.0.0-Linux-armv7l.sh
# say yes to everything
./Berryconda3-2.0.0-Linux-armv7l.sh
source ~/.bashrc
conda update conda -y
conda install paho-mqtt -y
## HOW TO INSTALL OPENCV ONLY IF WE USE IT ON THE PI SO DONT TO THIS UNLESS SOMETHING IS NOT WORKING AND ASK WILL
conda install opencv -y
## run all of these to get IMU up and running
sudo apt-get update
sudo apt-get upgrade
conda upgrade conda
conda update conda -y
pip install --upgrade pip
sudo apt-get install git vim tree i2c-tools libi2c-dev
## try this but it might not work
conda install -c conda-forge smbus2
## if failed run
pip install simbus
pip install simbus2
# open this file
sudo vim /etc/modprobe.d/raspi-blacklist.conf
# put a "#" in front of this line if exists
blacklist i2c-bcm2708
# save and quit with :wq only if you made a change and just do :q if no changes were made
# open this file
sudo vim /etc/modules
# add lines
i2c-dev
i2c-bcm2708
# :x to save and quit
# open
sudo vim /boot/config.txt
# add lines
dtparam=i2c_arm=on
dtparam=i2c1=on
# :x save and quit
# reboot
sudo reboot -h now
# ssh back in
ssh pi@raspberrypi.local
# run this
sudo i2cdetect -y 1
# clone repo
git clone http://github.com/ozzmaker/BerryIMU.git
# change into directory
cd BerryIMU/python-BerryIMU-gryo-accel-compass-filters/
python berryIMU.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment