Tuesday, November 25, 2014

Tips on commands for setting up Debian post installation

Hey there guys, yet another post, for those of you who use Debian OS and its distributions such as Raspbian, Ubuntu (might be juust a little bit different for it so lets just exclude it for now to be on the safe side) ,etc. Assuming you have installed Debian yourself and want to configure it further....Loooook no further...Here are some commands that will come really handy...so lets delve in! : )

To see all the installed packages
#dpkg -l

To install dpkg packages

Get to the dpkg package directory structure
#sudo dpkg -i filename

Get the status of all the services running

#service --status-all (for raspbian)
and
#ps aux (for debian)

To add other users to the group sudo
as root, do
#usermod -aG sudo username
To become root,
#su
(prompts for root password so just give it!) and there you go, your are root

Setup Proxy variable in terminal (just an example)
export http_proxy="100.100.100.0:8080" 
export https_proxy="100.100.100.0:8080" 
export ftp_proxy="100.100.100.0:8080"

To export proxy at shell startup
#nano .bashrc
and add the above export commands inside the bash file. Here we give initialization commands, environment path values for shell. Leave no spaces before and after '='

For apt cache config
Do
#nano /etc/apt/apt.conf and edit as an example shown below
Acquire::http::Proxy "http://192.168.0.1:4545/";
Acquire::https::Proxy "https://192.168.0.1:4545/";
Acquire::ftp::Proxy "ftp://192.168.0.1:4545/";
Save the file, Ctrl+O 

Chown
Ownership of a file to a particular user
#chown -R username:username filename

Uptime gives the duration of yours system's uptime
#uptime

Opening a jar file
#java -jar filename.jar

List all the removable drives to be mounted
#ls /dev/sd*

Get file from sftp(secure ftp)
#sftp user@192.168.0.xxx
you will be prompted for the user's password
view the files like in any command line
#ls
Fetch the file
#get filename
To exit from sftp login
#exit

Get file using scp(secure copy)

#scp source destination@192.168.219:~/
(prompted for destination's password)

Enable bash completion in interactive shells
go to the file
#sudo nano /etc/bash.bashrc
uncomment the area of code in the file
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
In case you want to change your configurable IP to static IP likely in the case of RPi when you want to ssh into your RPi without connecting to a monitor and its paraphernalia

#sudo nano /etc/network/interfaces
and edit the file as below
auto lo
iface lo inet loopback
iface eth0 inet static
      address 192.168.1.58
      netmask 255.255.255.0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
then
Ctrl+O (save it)
and then, restart the network as mentioned below

Restart network service
#service networking restart