-
Enable sudo and add user to sudoers
# apt install sudo
# adduser myuser-1 sudo
# chmod 0440 /etc/sudoers
$ sudo echo "it works"
- If you have sudo:
sudo usermod -aG sudo,group2 myuser-1
- https://linuxize.com/post/how-to-add-user-to-group-in-linux/
-
Installing docker now need a degree: https://docs.docker.com/engine/install/debian/
-
less longfile.txt
Scroll forward:
Ctrl-f
Scroll backward:Ctrl-b
End of file:G
Quit less:q
-
Get the amount of your physical RAM:
grep MemTotal /proc/meminfo
-
Kill a process: https://www.cyberciti.biz/faq/how-to-check-running-process-in-linux-using-command-line/
- find it
# ps -aux
or# top
# kill pid
- find it
-
https://unix.stackexchange.com/questions/31824/how-do-i-attach-a-terminal-to-a-detached-process
-
https://developers.redhat.com/cheat-sheets/linux-commands-cheat-sheet
-
https://developers.redhat.com/cheat-sheets/advanced-linux-commands
-
check size of folder/ file : https://shapeshed.com/unix-du/
-
rsync:
-
-
Save refactormyself/aed40a46333085e8a78972d476be00cb to your computer and use it in GitHub Desktop.
-
First install them
sudo apt install ctag cscope
-
For the kernel:
make defconfig cscope ctags R .
-
grab this vimrc https://github.com/ddvlad/cfg/blob/master/_vimrc
resources:
- https://linux-kernel-labs.github.io/refs/pull/183/merge/labs/introduction.html
- http://cscope.sourceforge.net/large_projects.html
- https://himadripandya.me/post/185609415870/how-cscope-makes-my-life-easier
- https://www.fsl.cs.sunysb.edu/~rick/cscope.html
- https://www.embeddedarm.com/blog/tag-jumping-in-a-codebase-using-ctags-and-cscope-in-vim/
-
To check if you are usin LVM - Logical Volume Mgmt
# apt install lvm2
# lvs
if nothing is shown then you are not using lvm- OR just check:
cat /etc/fstab
@more - https://askubuntu.com/a/202652/804122
-
Ran out of swap ?! How do you extend it
-
Create or Extend existing partition: https://opensource.com/article/18/9/swap-space-linux-systems https://www.thegeekdiary.com/how-to-extend-an-lvm-swap-partition-in-linux/ https://www.2daygeek.com/add-extend-swap-space-linux/
-
Create a SWAP file: https://askubuntu.com/questions/178712/how-to-increase-swap-space https://unix.stackexchange.com/questions/297149/how-to-resolve-the-insecure-warning-in-swapon https://linuxize.com/post/create-a-linux-swap-file/ https://linuxhint.com/change_swap_size_ubuntu/
- make sure the swapfile is owned by root:root
- make the file permission is 0600
- why? research and blog
-
-
File Permissions:
-
Free up SWAP: just switch off, wait a bit and switch it back on https://www.redhat.com/sysadmin/clear-swap-linux
-
Swapiness Issue"
60
saheed@saheed-deb:~$ sudo sysctl vm.swappiness=sudo sysctl vm.swappiness=100
[sudo] password for saheed:
sysctl: setting key "vm.swappiness": Invalid argument
vm.swappiness = sudo
sysctl: cannot stat /proc/sys/sysctl: No such file or directory
vm.swappiness = 100
- extract a tar file:
tar -xvf file.tar
tar -xzvf file.tar.gz
tar -xjvf file.tar.bz2
-x : Extract a tar ball.
-v : Verbose output or show progress while extracting files.
-f : Specify an archive or a tarball filename.
-j : Decompress and extract the contents of the compressed archive created by bzip2 program (tar.bz2 extension).
-z : Decompress and extract the contents of the compressed archive created by gzip program (tar.gz extension).
ref: https://www.cyberciti.biz/faq/tar-extract-linux/
-
These tools are all deprecated:
ifconfig
,ipconfig
,,ifup
,ifdown
, ... -
List interfaces :
ip address
orip a
; if not found you need to install the driver -
Brint it up:
ip link set wlan0 up
or down -
I tried to use
iw
to setup my wifi but it did not work- I think this is beacause I have set the wifi interface to allow-hotplug
- the config setup is done in: /etc/network/interfaces.d
- It should have looked like: \
auto eth0 iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 auto wlan0 iface wlan inet dhcp wpa-ssid <my ssid> wpa-psk <aes key> # address 192.168.1.11 # netmask 255.255.255.0 # gateway 192.168.1.1
-
wpa_supplicant
worked instead. Nice setup details is here- you will have to setup the config in: /etc/wpa_supplicant/wpa_supplicant.conf
-
Very use infor:
- https://wiki.archlinux.org/index.php/Network_configuration
- https://wiki.archlinux.org/index.php/Network_configuration/Wireless
- https://wiki.archlinux.org/index.php/Network_configuration/Ethernet
- https://www.cyberciti.biz/faq/linux-list-network-cards-command/
- https://www.linuxbabe.com/command-line/ubuntu-server-16-04-wifi-wpa-supplicant
-
Ethernet tool:
apt install -y ethtool
-
GCC and other dev tools:
apt install build-essential
-
Kernel Headers:
apt install linux-headers-$(uname -r)