Change the layout to suit. List available layouts and options:
more /usr/share/X11/xkb/rules/base.lst
Set the layout:
setxkbmap -layout 'us,us' -option 'ctrl:swap_lalt_lctl'
Prevent gnome from clobbering the changes:
sudo gsettings set org.gnome.settings-daemon.plugins.keyboard active false
stow
will generate symlinks for a given directory tree, thus making it easy to keep files backed-up, managed, etc.
https://www.gnu.org/software/stow/
Create quick and easy GUI widgets from the command line, and use the return to further do other actions...
zenity
Is simply awesome! Example - display a prompt with text input, and use the input to populate the clipboard...
zenity --entry | xsel --clipboard
man bash
- show the manual page for a commandtldr tar
- show examples of using a commmand
inxi -F
- print the detailed system / hardware infowhoami
- return the current user nameuname -a
- print out some basic system info (e.g. Kernel version)uptime
- show the time the system was up and the load averageslshw
- list hardwarelsusb
- list USB deviceslspci
- list PCI deviceslsblk
- list block devices (e.g. disk partitions and loopback devices)
top
- show linux processes, cpu utilization, memory usage etchtop
- an "improved" version oftop
glances
- an alternative tohtop
, includes disk and network statsvmstat 1
- print out (every second) the resource utilization in a tabular formatfree
- display the amount of free and used memoryiostat 1
- report (every second) read/write and other statistics for devices and partitionss-tui
- show graphs of frequency, utilization and temprature of CPU, as well as the power usagesudo powertop
- power consumption / power management toolstress -c 4
- run 4 CPU-loading workers (can also stress-test memory, io etc.)
ps aux | grep java
- show running java processespstree
- show running prcesses as a treekill process_id
- send a signal for the process to terminate (orkill -9 pid
to forcefully terminate the process)crontab -l
- list (edit) cron jobs of the current userreboot
- signal system to rebootpoweroff
- signal system to shutdown (works great with Alt+F2 in Cinnamon/Gnome)
dmesg --level err,warn
- show errors/warning in the kernel ring buffersudo systemctl start|stop|restart|reload docker
- start/stop/restart/reload a systemd unit (e.g. docker daemon)sudo service --status-all
- show status of all services (can also start/stop/restart/reload individual services)journalctl -b
- show all journald messages from this bootstrace -f script.py
- trace system callsman 2 open
- shows a manual for a system call
dpkg -l
- lists all installed packagesdpkg -S /usr/bin/ab
- shows the package owning a fileapt search linux-image-*
- searches repos for a packageapt policy linux-image-4.13.0-45
- shows repositories that contain the package
whereis ls
- locate the binary, source, man page for a commandln -s file symlink
- create a symbolic link to a file / foldermd5sum file.tar.gz
- calculate MD5 checksumfind ~/Document -name *.sh
- find files under the given directorytar xzf source.tar.gz
- extract a gzipped archive in the current directoryzip -r my.zip ~/Documents
- package and compress a directory as a zip filesed -i -e 's/find/replace/g' filename
- replaces a string in a fileperl -p -i -e 's/find/replace/g' filenames
- replaces a string in one or more files
id
- print current user and group IDssudo useradd john
- create a new usersudo passwd john
- change password of the user (or justpasswd
for the current user)sudo userdel -r john
- remove the user and their home directorysudo groupadd visitor
- create a new group (groupdel
to delete group)sudo adduser john visitor
- add the user to the groupw
andwho
- show who is logged in and their activitychmod u+x script.py
- make a file executable by the user owning itchown ubuntu:ubuntu ~/Applications
- change ownership of a file / directory
Bonus...apply the new group to the user without needing to logout
newgrp <groupname>
df -h
- report disk space usagedu -sh ~/Documents
- estimate file / directory space usagedd if=file.iso of=/dev/usb_drive status=progress
- make a bootable usb drive from an isohybrid filefindmnt
- list (or search in) all mounted file systemsmount /dev/sdb2 /media/myusername/usb/
- mount a file system (e.g. usb drive)umount /dev/sdb*
- unmount a file system (e.g. usb drive)mkfs.ext4 /dev/sdb2
(and bunch of othermkfs.*
) - create a filesystem in a disk partitionsudo fdisk -l
- list / manipulate disk partitions (using MBR, hence only for <2TB disks)gdisk
- GPTfdisk
(supports disks >2TB)sudo parted -l
- an alternative tofdisk
/gdisk
rsync
- sync files to / from a remote host
ssh -L 9999:remote-postgres:5432 bastion-host
- connect remotely to servers / create tunnels to access resources from a different networkscp myapp.jar remote-server:/tmp/myapp-1.0.jar
- copy file(s) securely over SSHwget http://example.com/backup.zip
- non-interactive download of files over HTTP(S) and FTPcurl -XGET http://example.com/api/v1/user/123
- transfer data over HTTP, FTP and other protocolsab -n 100 url
- Apache HTTP server benchmarking tool (WARNING! don't DDoS servers you don't own)
nmcli
- a cli tool for controlling NetworkManagerping 8.8.8.8
- test connectity between host and provided IPtraceroute 8.8.8.8
ortracepath 8.8.8.8
- trace packets route to a hostdig example.com
ornslookup example.com
- tools for "interrogating" DNS name serversip address
(or now deprecatedifconfig
) - show / manipulate network interfacesip route
(or now deprecatedroute
) - show / manipulate the IP routing tableip link set eth0 up/down
(ifup
/ifdown
) - enable / disable a network interfacess -a
(or now deprecatednetstat
) - list open socketsiw
(or now deprecatedifconfig
) - show / manipulate wireless devicestcpdump -i eth0 port 80
- capture traffic off a network interfacetcpflow -c -i eth0 port 80
- capture and save traffic for analysis / debuggingnmap
- network exploration tool / port scannernc
(or more versatilesocat
) - listen on / connect to ports, forward data etc.
env
- print all environment variableshistory
- print the history of executed commandswhich
- locate a command in $PATHcat args.txt | xargs command
- turn each line of input into an argument for a commandalias l='ls -l'
- create an alias for the commandsleep 30 > output.log 2>&1 &
- run a command in the background, redirecting its output to a filejobs
- list processes started by the current shell (e.g. with&
or by pressing Ctrl+Z)fg
- run a previously suspended (or started in backgroud) process (spawed by the current shell) in the foregroundbg
- run a previously suspended process in the backgroundnohup sleep 30 &
- allow the process to outline the shell that it was started from (by ignoring HUP signal)time sleep 1
- measure time the command takes to executewatch
- run a command repeatedly, monitoring the outputcat my.txt | head -n 10
- limit output to first n linestail -n 10 -f output.log
- show last n lines and then keep reading from (following) the fileecho "hello" | tee trace.txt
- read from std in and write to std out cloning output to a file / another commandcat output.log | grep keyword | wc -l
- count the number of (lines or words), here only those containing a keyword due togrep
vmstat 1 | awk '{print $1}'
- use AWK programming language (here used to extract 1st column of a tabular output)cat file.json | jq .
- prettify / process JSON
umount /dev/sdb*
sudo fdisk -l
and figure out how the USB drive is called (e.g./dev/sdb
)sudo mkfs.vfat /dev/sdb -I
dd if=~/Documents/ISOs/linuxmint-19-cinnamon-64bit-beta.iso of=/dev/sdb status=progress
NOTE: Before Bash executes the dot files mentioned below, it also executes commands from /etc/profile
or /etc/bash.bashrc
(depends on the type of the shell). You can find more info on this topic in man bash
.
.bash_profile
- is executed (by Bash) for interactive login shells (in my case it simply sources.bashrc
).bashrc
- is executed (by Bash) for interactive non-login shells (e.g. the ones started by Tmux, Guake or any other GUI Terminal).bash_aliases
- (at least in my case) is sourced directly by.bashrc
, and contains various command aliases / functions.profile
- is executed (by Sh, or other shell types if their config is missing) for interactive login shells.inputrc
- configuration of GNU readline (I only use it to make Bash auto-completion ignore case).selected_editor
- allows setting the default text editor, which, for example, is opened bycrontab -e
.gitconfig
- global configuration for Git (the version control tools).npmrc
- configuration fornpm
, NodeJS package manager.tmux.conf
- configration for Tmux.ssh/config
- configuration for SSH client (allows defining aliases for hosts, keys to be used for each server etc.).gnupg/gpg.conf
- gpg/gpg2 configuration.gnupg/gpg-agent.conf
- gpg agent configuration (if you are using gpg-agent instead of ssh-agent)
-
~/.xsession-errors
- error log produced by X server (look here if you have troubles logging into the system) -
~/.local/share/applications/
- stores user-specific desktop files (place your custom desktop files here) -
/usr/lib/jvm/
- directory whereapt
/dpkg
will install Java -
/var/log
- contains logs generated by the OS and other apps
In order to be able to install and/or get the latest version of the following software, add the repos mentioned below:
- TLP
sudo add-apt-repository ppa:linrunner/tlp
- Yubikey Tools
sudo add-apt-repository ppa:yubico/stable
- Vivaldi
echo "deb http://repo.vivaldi.com/stable/deb/ stable main" | sudo tee /etc/apt/sources.list.d/vivaldi.list > /dev/null
wget -q -O - http://repo.vivaldi.com/stable/linux_signing_key.pub | sudo apt-key add -
- Chrome
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list > /dev/null
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
Depending on your Linux distro, you might also want to add more repos to be able to use the latest versions of the following: Docker, NodeJS, Postgres etc.
-
apt install guake
- Guake - a dropdown terminal that can be shown / hidden with a shortcut -
apt install tmux
- Tmux, a terminal multiplexer, e.g. allows splitting your terminal into panes -
apt install vim-gnome
- Vim, a version of Vim that allows yanking/pasting to/from the clipboard ("+y
/"+p
) -
apt install direnv
- Direnv, unclutter your.bashrc
by moving environment vars to individual.envrc
files -
apt install docker.io
- Docker, software for running containersi.e. the lightweight VMs -
apt install vivaldi-stable
- Vivaldi, a browser that supports grouping multiple web pages in a single tab -
apt install google-chrome-stable
- Google Chrome, a free web browser from Google, IMO a bit more stable than Chromium -
apt install tlp tlp-rdw
- TLP, a Linux power management tool, must-have on laptops -
apt install nodejs
- Node.js, a javascript runtime, brings npm on board -
apt install snapd
- Snappy, a cross-distro package manager developed by Canonical -
apt install yubioath-desktop yubikey-neo-manager yubikey-personalization-gui
- Yubikey Authenticator, Yubikey Neo Manager, Yubikey Personalization Tool, all needed, one way or another, in case if you are using Yubikeys -
apt install virtualbox virtualbox-qt
- VirtualBox, software for running VMs -
apt install vagrant
- Vagrant, a tool for managing development environments, requires VirtualBox or an alternative -
apt install wireshark-qt
- Wireshark, a GUI for wireshark packet analyzer -
snap install skype
- Skype, a text/voice/video chat apppwnedowned by Microsoft -
snap install slack
- Slack, a team colaboration tool, i.e. a text chat on steroids -
snap install spotify
- Spotify, a music streaming app by Spotify -
snap install intellij-idea-ultimate
- Intellij IDEA, possibly the best IDE for developing any app that is JVM-based, there is also a free community edition with less features -
snap install bitwarden
- BitWarden, an open source password manager done right (at least from the user perspective) -
pip install --user s-tui
- S-TUI, a cli tool that graps cpu freq, utilization and temperature over time -
npm install -g tldr
- TLDR, a great collection of simplified man pages, first stop for help on any terminal command
To use some of the commands from this reference, you will need to install the following packages: apt install
htop
powertop
glances
jq
apache2-utils
TODO Check if there are more packages I need to include. Also, try using flatpak instead of snapd, at least for deps that can be installed from flathub.
TODO Add to the list: docker-compose
, kubectl
, aws cli
, sdkman
After I had almost finished compiling my list of commands, I actually discovered at least a couple of vastly overlapping Terminal references, which you might also want to check out (see the links below).