Linux notes general
Commands
- cat - contatenate
- tac - concatenate in reverse
column command
The column utility formats its input into multiple columns.
printf "a:b:c\n1::3\n" | column -t -s ':'
| a | b | c |
| 1 | 3 |
Note that this output is different from one that is printed in terminal. Strange… Below is the terminal output.
| a | b | c |
| 1 | 3 |
uuidgen universal unique id generator
Generate unique ID’s
script Records terminal
man script
man scriptreplay
Example
script --timing=file.tm script.out
# Write some scripts
# Exit with `exit` or `^d`
scriptreplay --timing file.tm --typescript script.out
reset Recover a borked terminal
Count number of files in a directory
ls -1 | wc -l
Building from source
./configure
./configure --prefix=$path
Redirections
2>&1
2>&1 > /dev/null
>
>/dev/null
>>
Keymaps
Ctrl-c
Ctrl-d
Ctrl-l
cp
cut
less
linux
seq
paste
pstree
du
rsync
sed
ssh
vifm
zip
Readline
C-x C-eto edit current commant in default text editor- or
vinvimode
ldd Print shared libraries
This command can be used to find all the shared library or libraries of a program
ldd /usr/bin/vim
| linux-vdso.so.1 (0x00007ffc13392000) | |
| libm.so.6 => /lib64/libm.so.6 (0x00007f85a0665000) | |
| libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f85a0639000) | |
| libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f85a060a000) | |
| libsodium.so.23 => /lib64/libsodium.so.23 (0x00007f85a05b1000) | |
| libacl.so.1 => /lib64/libacl.so.1 (0x00007f85a05a7000) | |
| libgpm.so.2 => /lib64/libgpm.so.2 (0x00007f85a059f000) | |
| libc.so.6 => /lib64/libc.so.6 (0x00007f85a039b000) | |
| /lib64/ld-linux-x86-64.so.2 (0x00007f85a0ba9000) | |
| libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f85a02fe000) | |
| libattr.so.1 => /lib64/libattr.so.1 (0x00007f85a02f6000) |
To check if a library is present ldconfig -p
https://serverfault.com/a/513938
ldconfig -p | grep libjpeg
Cronie
- https://askubuntu.com/questions/978382/how-can-i-show-notify-send-messages-triggered-by-crontab
- https://fedoramagazine.org/scheduling-tasks-with-cron/
sudo dnf install cronie
Unsorted
who
killall process_name(or)pid
alias
apropos
apt
apt-get
bc
cal
cat
cd
clear
chsh
date
df
diff
file
find
find -name "*name*"
fish
free
git add *
git commit -m "stuff"
git pull
git push
git status
git update
grep
grep string -r *; # This will follow symbolic links
grep string -r .; # This doesnot follow symbolic links
grep string -r; # same as next command
grep string file_name
head
help
hg add *
hg commit -m "stuff"
hg import --no-commit file.patch
hg pull
hg push
hg status
hg update
info
kill
kill -9
killall
less
lolcat
ls
lsb_release -a
make
make clean
make install
man
pushd popd
pwd
readlink -f
realpath
reboot
rename
rev
rsync
rsync -CazhPvu
sed
sh
sort
ssh -Y
ssh -x
ssh-copy-id -i .ssh/id_rsa.pub USER@HOST
stow
sudo apt install
sudo apt list
sudo apt update
sudo apt upgrade
tac
tail
tee
time
tmux
tmux attach
touch
tree
type
uname -a
uniq
unzip file.zip -d dir_ext
w
wall
wc
wc -l
wget
whatis
which
yes
zsh
tftp DOWNLOAD name.txt
tftp DOWNLOAD name.txt .; # This does not work. '.' will make the downloaded file 0 bytes
lshw; # List hardware
ls -1 | wc -l # Count number of files in a directory
cat
locate
make
Manual
https://www.gnu.org/software/make/manual/make.html#Rule-Introduction
Usage
Under current directory with make file targets
make target
Include other paths / directories
make -I dir -I dir2 ... target
Others
Create a desktop icon on Ubuntu or Debian based systems
Produce high cpu load
openssl speed -multi $(grep -ci processor /proc/cpuinfo)
Gnome Notification
https://stealthcopter.com/blog/2010/02/utilising-the-notification-system-in-kde-or-gnome-in-bash-scripts-ubuntu-9-10-linux/
Adding a user in Linux
sudo user add -m <username>
Note the -m option, this creates the /home/
To delete a user
sudo userdel <username>
Useful Tools
https://myrepos.branchable.com/
https://nixos.org/download.html
curl -L https://nixos.org/nix/install | sh
nix-env -if https://github.com/jwoudenberg/shy/archive/main.tar.gz
shy