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)
#ps aux (for debian)

To add other users to the group sudo
as root, do
#usermod -aG sudo username
To become root,
(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="" 
export https_proxy="" 
export ftp_proxy=""

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
#nano /etc/apt/apt.conf and edit as an example shown below
Acquire::http::Proxy "";
Acquire::https::Proxy "";
Acquire::ftp::Proxy "";
Save the file, Ctrl+O 

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

Uptime gives the duration of yours system's 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
Fetch the file
#get filename
To exit from sftp login

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
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
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Ctrl+O (save it)
and then, restart the network as mentioned below

Restart network service
#service networking restart