Ruixiang
  • Home
  • Work
  • Projects
  • Wiki
Ruixiang
Ruixiang

Linux Commands

A reference to commonly used commands

Add new user

$ sudo adduser --ingroup users <USERNAME>
$ sudo adduser <YOUR_USERNAME> sudo
$ logout
$ sudo deluser --remove-home user

Setup Wifi

  • Generate WPA passphrase for your WiFi
$ wpa_passphrase <ssid> <password>
  • Update /etc/network/interfaces
$ sudo nano /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp
wpa-ssid <ExampleWifi>
wpa-psk <wpa-psk-generated-by-wpa-passphrase-command>

Update system time

$ sudo apt-get install ntp

Download a file using curl:

$ curl -O link-to-remote-file

Get root privileges:

if root user account is enabled.

$ su

You can logout using key: Ctrl+D

Otherwise if system only allows using sudo

$ sudo -i

Merge multiple PDFs into one

# Install pdftk
$ sudo snap install pdftk
# Merge files
$ pdftk file1.pdf file2.pdf cat output result.pdf

Create gif animation using "imagemagick"

$ convert -delay 120 -loop 0 *.png animated.gif

Screenshot and screencast

$ sudo apt install kazam

Get statistics of a code base

$ sudo apt install cloc
$ cd <code-folder>
$ cloc --exclude-dir=cmake,third_party .

Reference

MiscellaneousCAN Bus in Linux

© 2021 Ruixiang. All rights reserved.