CLI cheat sheet
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
CLI cheat sheet
Just found this great little cheat sheet for CLI commands. http://fosswire.com/2007/08/02/unixlinu ... eat-sheet/
Download it, print it and keep it local. Its great for beginners (like myself) who have a hard time remember all of the commands
Download it, print it and keep it local. Its great for beginners (like myself) who have a hard time remember all of the commands
____________ ________ ______ ____ ___ __ __ _
http://www.designdrifter.com
The Purpose of Life is for DNA to reproduce.
http://www.designdrifter.com
The Purpose of Life is for DNA to reproduce.
That is handy. Here is a list of Debian/Ubuntu commands that I recorded while I was learning to use Linux. The commands and descriptions are all separated by "=", so don't include the = sign in the commands.
cat /proc/cpuinfo=CPU info
cd=change directory
convert -resize 640x480 -colors 14 wallpaper.png splashimage.xpm && gzip splashimage.xpm=change picture into grub splash.
cp=copy
df -h=disk space usage
etc/gnome/default.list=file of default programs
fglrxinfo=graphics driver info
free -m=memoryusage
glxgears=check 3d graphics
glxinfo=opengl info
ifconfig=network configuration info
killall gnome-panel=kill,refresh panel
locate=find target
lsb_release -a=OS info
lshw=list hardware
ls=list contents
lspci=list pci devices
man command | col -b > file.txt=save man uotput to file
man -f=man title of target
man intro=user commands help
man -k=man file for target
man man=man manual
mkdir=make directory
mv=move
netstat -l --tcp --udp (and then) watch -n 1 netstat -an --tcp --udp=watch port activities
rmdir=remove directory
rm=remove
rm -r=remove all
sudo apt-cache=debian apt library
sudo apt-cache search (search subject)=Search debian repo for apps
sudo apt-get dist-upgrade=upgrade all
sudo apt-get update=update sources.list
sudo cp /<filename.backup>/<filename>=reset to backup file
sudo deborphan | xargs sudo apt-get -y remove –purge=remove orphans
sudo dmidecode | more=Detailed hardware info
sudo dpkg -l | cut -d " " -f 3=list installed packages
sudo dpkg-reconfigure menu sudo dpkg-reconfigure menu-xdg (reboot)=fix Debian menu
sudo dpkg-reconfigure xserver-xorg=Reconfigure periphials, graphics
sudo fdisk -l=View Hard drive partitions
sudo hdparm -l /dev/sda=hard drive settings
sudo hdparm -tT /dev/sda=hard drive speed
sudo ln -s ~/.themes /root/.themes sudo ln -s ~/.icons /root/.icons sudo ln -s ~/.fonts /root/.fonts=make root look like user
top=system,processes,resources,cpu,ram,etc. info
uname -a=kernel version
update-menu=update gnome menu
whereis program-name=location of program/man page
which <program name>=location of program
cat /proc/cpuinfo=CPU info
cd=change directory
convert -resize 640x480 -colors 14 wallpaper.png splashimage.xpm && gzip splashimage.xpm=change picture into grub splash.
cp=copy
df -h=disk space usage
etc/gnome/default.list=file of default programs
fglrxinfo=graphics driver info
free -m=memoryusage
glxgears=check 3d graphics
glxinfo=opengl info
ifconfig=network configuration info
killall gnome-panel=kill,refresh panel
locate=find target
lsb_release -a=OS info
lshw=list hardware
ls=list contents
lspci=list pci devices
man command | col -b > file.txt=save man uotput to file
man -f=man title of target
man intro=user commands help
man -k=man file for target
man man=man manual
mkdir=make directory
mv=move
netstat -l --tcp --udp (and then) watch -n 1 netstat -an --tcp --udp=watch port activities
rmdir=remove directory
rm=remove
rm -r=remove all
sudo apt-cache=debian apt library
sudo apt-cache search (search subject)=Search debian repo for apps
sudo apt-get dist-upgrade=upgrade all
sudo apt-get update=update sources.list
sudo cp /<filename.backup>/<filename>=reset to backup file
sudo deborphan | xargs sudo apt-get -y remove –purge=remove orphans
sudo dmidecode | more=Detailed hardware info
sudo dpkg -l | cut -d " " -f 3=list installed packages
sudo dpkg-reconfigure menu sudo dpkg-reconfigure menu-xdg (reboot)=fix Debian menu
sudo dpkg-reconfigure xserver-xorg=Reconfigure periphials, graphics
sudo fdisk -l=View Hard drive partitions
sudo hdparm -l /dev/sda=hard drive settings
sudo hdparm -tT /dev/sda=hard drive speed
sudo ln -s ~/.themes /root/.themes sudo ln -s ~/.icons /root/.icons sudo ln -s ~/.fonts /root/.fonts=make root look like user
top=system,processes,resources,cpu,ram,etc. info
uname -a=kernel version
update-menu=update gnome menu
whereis program-name=location of program/man page
which <program name>=location of program
Re: CLI cheat sheet
if you cant rember a command that you have jused before just type history and u will get a list of all your previous commands
- Zwopper
- Level 10
- Posts: 3054
- Joined: Fri Nov 30, 2007 12:20 pm
- Location: Deep in the Swedish woods
- Contact:
Re: CLI cheat sheet
...or use the arrow keys - up and down...
Tab comes in handy as well for filling out...
Tab comes in handy as well for filling out...
My artwork at deviantART | My Band - Electric Alchemea
CREA DIEM!
Lenovo U330P | i5 | 16GB | 128GB - SSD | Elemantary OS 0.4
Re: CLI cheat sheet
thanks....that will be very useful for me...
Comptia A+ Certified Technician
Comptia Network + Certified Technician
You can not have Success without Failures.
Comptia Network + Certified Technician
You can not have Success without Failures.
Re: CLI cheat sheet
So true!MerelyJim wrote:Thanks!
The command line never goes out of style.
Re: CLI cheat sheet
Then you can !+number to repeat a history command, e.g. if history displaysdragons.r.scary. wrote:if you cant rember a command that you have jused before just type history and u will get a list of all your previous commands
Code: Select all
169 sleep 40m; cd /datastorage/user1/enc/JDownloader ; java -jar /datastorage/user1/enc/JDownloader/JDownloader.jar
When looking for some command you partially remember, use
Code: Select all
history | grep keyword
Code: Select all
history | grep JDownloader
Re: CLI cheat sheet
this is fantastic. Glad I came across this thread. And thanks for all the people who made contributions to this thread.
Re: CLI cheat sheet
Nice thread, thanks alot!
I have been using for some while now hard time remembering ALL the commands so this is very useful
I have been using for some while now hard time remembering ALL the commands so this is very useful
Re: CLI cheat sheet
Great resource thread! Thank you for putting this together. I've been lurking in the forums since making the switch from W8 to Linux, and I've been looking for something like this. I've been creating my own CLI lists as I go, but they're mainly geared towards building Android...Outside of those commands and a few very basic ones, I always needed to search for commands, prior to executing them. This will provide me with a very handy quick reference guide, so I can begin to commit some of these commands to memory.
Re: CLI cheat sheet
Here are some of my faveorite commands that I use regularly. Look them up if you need help with them by doing man <command>. Replace all instances of <command> or <2nd_command> with an actual command that you want to use. Ignore anything after a // as thats a comment!
ls -aR //list all files recursively
less //lets you scroll through large outputs
cat //list entire file. Useful when piped into other commands
grep //search for stuff within files or output
whereis //find stuff
find //find more stuff
locate //Guess what? Also lets you find stuff.
which //And who would have thought! Find more stuff!
pushd //push directory
popd //pop directory
cd //change directory
mkdir //make directory
rmdir //remove directory
<command> | <2nd_command> //piping commands into eachother
<command> > file.txt //outputs to a file.
man //get help
top //lists processes and resources usage
kill //kill a frozen or resource hogging proccess
And a few others like netstat and blkid and such that have there uses, but not used regularly. Why do I use top regularly? I'm a n00b programmer, and sometimes my programs get memory leaks so I use top to find the offending proccess and then kill it. Why do I also use 5 different commands to search for stuff? Each command searches for different things in different ways. All 5 have their uses. Though grep is probably most useful. And yes, I do (mostly) read man pages when I get stuck.
I may post more useful commands in the future. There are a LOT of them.
Happy command line adventures,
JohnBobSmith
ls -aR //list all files recursively
less //lets you scroll through large outputs
cat //list entire file. Useful when piped into other commands
grep //search for stuff within files or output
whereis //find stuff
find //find more stuff
locate //Guess what? Also lets you find stuff.
which //And who would have thought! Find more stuff!
pushd //push directory
popd //pop directory
cd //change directory
mkdir //make directory
rmdir //remove directory
<command> | <2nd_command> //piping commands into eachother
<command> > file.txt //outputs to a file.
man //get help
top //lists processes and resources usage
kill //kill a frozen or resource hogging proccess
And a few others like netstat and blkid and such that have there uses, but not used regularly. Why do I use top regularly? I'm a n00b programmer, and sometimes my programs get memory leaks so I use top to find the offending proccess and then kill it. Why do I also use 5 different commands to search for stuff? Each command searches for different things in different ways. All 5 have their uses. Though grep is probably most useful. And yes, I do (mostly) read man pages when I get stuck.
I may post more useful commands in the future. There are a LOT of them.
Happy command line adventures,
JohnBobSmith
-
- Level 3
- Posts: 153
- Joined: Mon Nov 03, 2014 8:16 pm
Re: CLI cheat sheet
hey this thread has some good tips and cli for us noobs
Re: CLI cheat sheet
You c-line junkies should love this too.
Most of us know that will run sudo on the last command, but how about sudo on the 3rd command from last?
Enjoy the Goodness.
Most of us know that
Code: Select all
sudo !!
Code: Select all
sudo !-3
Re: CLI cheat sheet
Ex FreeBSD junkies particularly may like to set a couple of lines in ~/.inputrc or ~/.bashrc to get backwards and forwards history search on up and down arrow keys (then you would just type sudo and up arrow searches history for commands issued that way, for instance):
https://wiki.archlinux.org/index.php/ba ... completion
(Answer provided by xenopeek. Thanks again.) http://forums.linuxmint.com/viewtopic.p ... 3&t=215057
-----------------------------
Some may not realise that when a script etc. asks for confirmation in the form [Y / n] the response shown capitalised is the default and pressing Enter would achieve the same as pressing the y key.
Similarly, I've seen professional online tutorials where one is instructed to click the Apply button in a dialog as well as the OK one. So unnecessary, but I think most people know that.
Edited to add: It may not be obvious, if your only previous experience of a command line was in <shudder> cmd.exe or real DOS, just how flexible the command line itself is in Linux. I've been mounting and unmounting a bit recently (folders not...) so I tend to up arrow after say 'sudo umount /dev/sdf1' - type the new mount point on the end of the line and then left arrow along and delete the u from umount. So the line I'm on looks like 'sudo mount /dev/sdf1 /mnt' and the cursor is on the m of mount. No need to right arrow (or press the End key (the home key also works)) to get to the end of the line. Hit Enter anywhere on the line to do it. A lot of functionality in that line.
Some manuals are long and so are other text files you may be reading with 'less'. You can easily search with a forward slash and a word you want to find. It even has its own history mechanism with forward slash followed by up arrow.
https://wiki.archlinux.org/index.php/ba ... completion
(Answer provided by xenopeek. Thanks again.) http://forums.linuxmint.com/viewtopic.p ... 3&t=215057
-----------------------------
Some may not realise that when a script etc. asks for confirmation in the form [Y / n] the response shown capitalised is the default and pressing Enter would achieve the same as pressing the y key.
Similarly, I've seen professional online tutorials where one is instructed to click the Apply button in a dialog as well as the OK one. So unnecessary, but I think most people know that.
Edited to add: It may not be obvious, if your only previous experience of a command line was in <shudder> cmd.exe or real DOS, just how flexible the command line itself is in Linux. I've been mounting and unmounting a bit recently (folders not...) so I tend to up arrow after say 'sudo umount /dev/sdf1' - type the new mount point on the end of the line and then left arrow along and delete the u from umount. So the line I'm on looks like 'sudo mount /dev/sdf1 /mnt' and the cursor is on the m of mount. No need to right arrow (or press the End key (the home key also works)) to get to the end of the line. Hit Enter anywhere on the line to do it. A lot of functionality in that line.
Some manuals are long and so are other text files you may be reading with 'less'. You can easily search with a forward slash and a word you want to find. It even has its own history mechanism with forward slash followed by up arrow.