I am primary Mac user (MacBook Pro), and a secondary Windows / Linux User. I have a pretty powerful Windows 10 gaming PC with Nvida Graphic card) which I have recently turned into a Dual-bootable machine (bootable between Windows 10 and Ubuntu 16.04 LTS). Given I am a pretty new Ubuntu user I very frequently have to look up commands to perform certain actions. this post aims to serve as my personal cheatsheet (for Ubuntu commands).
Machine Specs:
- (Rough) MacBook Pro Spec: El Capitan, i7 CPUs, 1TB HDD, 16 GB RAM, Intel Graphic.
- (Rough) Gaming PC Spec: Dell XPS 8700, i7 CPUs, 16 GB RAM, 2TB HDD, onboard Intel Graphic card plus with a physical Nvida GeForce GTX 750 Ti Graphic Card).
Here are some commands that are slightly beyond basics, but ultra handy.
How do I find out the model of my graphics card?
lspci | grep VGA
to see if my NVIDIA 750Ti is detected.
ls -dl [ac]*
- lists out only the directories beginning with the letter a
or c
at the current path Stackoverflow
cd -
- go back to the previous directory. (it's sort of like back one page in a browser.)
ls -lh
- list files within the current directory. The h
shows the size of file / folder in a human readable format (kilo- / mega / giga / etc bytes). append these: a
: show hidden file, d
show directory only.
find . -name doc | wc -l
- within the current directory, recursively find all files beginning with the string 'doc', then count & display observations.
- apt-get is high level package manager. dpkg is low level package manager.
sudo apt-cache search lynx
- search the lynx package on APT.sudo apt-get install lynx
- install the lynx package (along with dependencies)sudo apt-get remove lynx
- remove the lynx package (and leave the dependencies alone). This is a safe option.sudo apt-get autoremove lynx
- remove the lynx package AND remove the dependencies (if not used by other packages). This is cleaner (providing you trust the publisher) but might cause problems. Avoid this.sudo apt-get upgrade
- update all installed packages.
yelp man:cat
- brings up the man page for the cat
function via a GUI.
ps
,ps -ef
,ps -eLf
pstree | head -10
- ps in graphical form.top
- realtime load avearges and processes
(press following keys while using top
)
key | action |
---|---|
t | Display or hide summary information (rows 2 and 3) |
m | Display or hide memory information (rows 4 and 5) |
A | Sort the process list by top resource consumers |
r | Renice (change the priority of) a specific processes |
k | Kill a specific process |
f | Enter the top configuration screen |
o | Interactively select a new sort order in the process list |
crontab -l
to display cron jobscrontab -r
to cancel cron jobscrontab mycrontab
to load the cron job from a bash scriptmycrontab
at
host linuxfoundation.org
- gives you the ip address of a web address.nslookup linuxfoundation.org
- shows you domain name info.cat /etc/hosts
- shows you the machine-IP mapping info.cat /etc/resolv.conf
- shows you the dynamically resolved IP of your network.- Lab: Network Troubleshooting - step-by-step guide.
- If Else condition
- Linux condition testing bracket
myLen1=${#string1}
- Saves the length of string1 in the variable myLen1.TEMP=$(mktemp /tmp/tempfile.XXXXXXXX)
- create a temporary file.TEMPDIR=$(mktemp -d /tmp/tempdir.XXXXXXXX)
- create a temporary directory
cups
package handles printing.ls
command relates to printing from terminal.