-----------------------------------------------------------------------------------------------------------------------------
Command Sheet #01
(Ubuntu) GNU/Linux
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------

sudo : power
sudo -k : seize power



cat - create, display and manipulate files
-----------------------------------------------------------------------------------------------------------------------------
cat > filename : create file, ctrl+d to exit
cat filename : view
cat file1 file2 > newfilename : to combine two



mkdir - create directory
-----------------------------------------------------------------------------------------------------------------------------
mkdir /somewhere/else : locate file using keywords



grep - search*
-----------------------------------------------------------------------------------------------------------------------------
grep keyword some/location

-v Shows all the lines that do not match the searched string
-c Displays only the count of matching lines
-n Shows the matching line and its number
-i Match both (upper and lower) case
-l Shows just the name of the file with the string



apt - package management*
-----------------------------------------------------------------------------------------------------------------------------
apt-get autoclean
apt-get clean
apt-get install
apt-get purge
apt-get update : refresh available updates
apt-get upgrade : upgrade all packages
apt-get remove
sudo add-apt-repository ppa:NAME/ppa
sudo add-apt-repository --remove ppa:NAME/ppa

apt-get dist-upgrade – upgrade with packagere placements; upgrade Ubuntu version
apt-get install pkg – install pkg
apt-get purge pkg – uninstall pkg
apt-get autoremove – remove obsolete packages
apt-get -f install – try to fix broken packages
dpkg --configure -a – try to fix brokenpackages
dpkg -i pkg.deb – install file pkg.deb(file)
/etc/apt/sources.list – APT repositorylist



various commands for getting around:
-----------------------------------------------------------------------------------------------------------------------------
pwd : print working directory
cd : where to
cd / : root
cd .. : up one level
cd - : previous directory

clear : wipe the screen

cp : copy*

chmod : change permissions on a file
chown : change ownership of a file

df : display used and available diskspace
du : display size of current directory and all of its subdirectories
history : history of commands

top : display processes using the most system resources,
“q” can be used to exit.
uname-a : wide range of basic information about the system

kill : stop a process
kill -9 pid : add -9 and the process id if necessary

man : manual of
info : similar to but more detailed than manual
ifconfig : show network information
iwconfig : show wireless information
-h : help with commands
whatis : description of commands

poweroff : bye



ls
-----------------------------------------------------------------------------------------------------------------------------
ls -R : subdirectories
ls -al : details
ls -al : hidden files
to make a list : ls > -R filename
: ls -R /directory > filename



mv
-----------------------------------------------------------------------------------------------------------------------------
mv file newlocation
to rename : mv filename newfilename
: mv directoryname newdirectoryname



rm
-----------------------------------------------------------------------------------------------------------------------------
rm
rmdir : remember to delete subdirectories first



-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
extras:
-----------------------------------------------------------------------------------------------------------------------------
ls `echo $PATH | sed 's/:/ /g'` | sed 's/^\/.*://' | sed '/^$/d' | sort | less
: for an alphabetic list of the usable commands which are currently installed

sudo iwlist scan : look for wireless networks
sudo /etc/init.d/networking restart – reset network for manual configurations
(file) /etc/network/interfaces – manualconfiguration
ifup interface – bring interface online
ifdown interface – disable interface

sudo /etc/init.d/gdm restart – restart X andreturn to login (GNOME)
sudo /etc/init.d/kdm restart – restart X andreturn to login (KDE)
(file) /etc/X11/xorg.conf – displayconfiguration
sudo dexconf – reset xorg.conf configuration
Ctrl+Alt+Bksp – restart X display if frozen
Ctrl+Alt+FN – switch to tty N
Ctrl+Alt+F7 – switch back to X display


-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------

some sources:
https://www.guru99.com/must-know-linux-commands.html
https://www.dummies.com/computers/operating-systems/linux/common-linux-commands/
https://techlog360.com/basic-ubuntu-commands-terminal-shortcuts-linux-beginner/
https://codeburst.io/a-beginners-guide-to-using-apt-get-commands-in-linux-ubuntu-d5f102a56fc4

-----------------------------------------------------------------------------------------------------------------------------