Basic Terminal

CLI >

Terminal keys

home moves the cursor to the beginning of the command line
end moves the cursor to the end of the command line
Ctrl-W deletes the word immediately before the cursor
Ctrl-K deletes everything immediately after the cursor
Ctrl-Y undo a deletion
Ctrl-C cancels the active process
Up cycles through previously made commands
Tab auto completes if there's only one possibility
Shift-pg up/home move up the terminal (handy with no scroll bar)/go to top
Shift-pg dn/end move down the termnal/go back to the prompt (down does too)
Ctrl-R shows reverse history, type a few letters to search a previous line, then press Ctrl-R repeatedly to find the command, and press Right, to edit, or hit Enter to execute



Apt commands

apt-get check [package] check dependencies
apt-get install -s [package] simulate install
sudo apt-get build-dep [package] attempt to install dependencies
apt-get install [package] install package
apt-get install -f [package] install without broken dependencies
apt-get install --reinstall [package] reinstall package
apt-get remove [package] remove package
apt-get remove --purge [package] remove package including its config files
apt-get clean clean cache
apt-get autoclean clean cache from packages that can't be downloaded
apt-get install -f clean broken install
sudo dpkg --configure -a or, failing that
apt-cache search [package] search for packages in the apt cache with a name, or part of a name
apt-cache show [package] to list dependencies of installed
apt-cache search [package] to list dependencies of package not installed
dpkg --list | grep <name> list any installed packages with a name
dpkg -s [package] check version of installed package
dpkg-query -l [package] also can use dpkg-query, wildcards too
dpkg -S [command] to find the package that owns a command
apt-get install --download-only [package] download a package but not install


see my upgrade Debian page for system upgrade commands



HowTo Build a Package from Source the Smart Way
http://forums.debian.net/...

convert a .rpm package (from Redhat Linux) to .deb package with alien
http://www.howtoforge.com/...





apt-history

This is one very good script I found, wriiten by Benjamin York, adapted from info given at http://redclay.altervista.org

Copy the script from https://github.com/blyork

 
paste the script and save

 
in a terminal run
 

paramaters:
install  - Lists all packages that have been installed.
upgrade  - Lists all packages that have been upgraded.
remove   - Lists all packages that have been removed.
rollback - Lists rollback information.
list     - Lists all contents of dpkg logs.




Other commands

whoami what user is logged in?
sudo shutdown -h now force shutdown = sudo halt
sudo shutdown -h 01:30 & planned shutdown
sudo shutdown -c cancel planned shutdown
sudo logout logout
sudo reboot reboot
rm -rf /some-dir/some-dir/ !delete a dir and its contents entirely !!!
lsblk get a list of local partitions
ls -l /dev/disk/by-uuid get the uuid of all partitions
free get memory usage stats
sudo passwd <username> change a user password
sudo passwd change the root password
apt-file update use apt-file
apt-file search [file name] find package that installs a missing file




Nano keys

ctrl-x close
ctrl-o save
ctrl-k cut line
ctrl-u uncut from buffer
ctrl-6 start select
alt-6 copy selected
ctrl-w search
alt-w repeat search
ctrl-\ search-replace
alt-/ go to last line
alt-\ go to top
ctrl-- go to line, column
alt-( go up a para.
alt-) go down a para.
ctrl-r insert another file
alt-t cut from cursor to end
alt-m toggle enable mouse




Top 25 Performance Monitoring Tools
thegeekstuff.com/2011/

50 most used Unix/Linux commands
thegeekstuff.com/2010/

Safe removal of data - file shredding
see this post http://superuser.com/...