Ubuntu - Linux - Commands
Ubuntu - Linux - Commands
How to shutdown/reboot
How to fix errors involving missing erl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
All installed packages via apt-get goes into the directory: /var/cache/apt/archives
how to remove the 12 packages can be installed message when you login via ssh
How to update known_hosts file when the ip address changes for a server and you try to ssh
How to allow a certain command be sudo by a particular user without password prompted.
How to restart jenkins when you accidentally lock yourself out by security
How to shutdown/reboot
To shutdown safely:
sudo shutdown -h now
To reboot:
sudo reboot
auto eth0
iface eth0 inet dhcp
The problem is basically because `yo angular appname` will attempt to create symlinks.
There is an issue with creating symlinks inside SharedFolders for VirtualBox VMs.
a) make sure you are running Linux variant as Host OS (Mac, Linux, etc)
d) now re-run the VM and execute the `yo angular appname`. If need be remove any previously
created files and folders by your previous `yo angular appname` command before re-running it.
http://stackoverflow.com/a/20002108/80353
netstat -tulpn
timedatectl
Command:
Go to:
auto eth0
iface eth0 inet static
address <ip address>
netmask <subnet mask>
gateway <gateway address>
https://help.ubuntu.com/10.04/serverguide/network-configuration.html
To configure a default gateway, you can use the route command in the following manner. Modify
the default gateway address to match your network requirements.
sudo route add default gw 10.0.0.1 eth0
To verify your default gateway configuration, you can use the route command in the following
manner.
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 eth0
/etc/hostname
and
/etc/hosts
Replace any instances of the existing computer name with your new one. When complete
run
(p.s the sudo service hostname start didn't work so had to restart the computer)
How to fix errors involving missing erl: warning:
Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale
("C").
if you need to ssh into the server, on the machine you ssh from make sure that you add the
following to your own .bashrc and .bash_profile
https://help.ubuntu.com/community/Mount/USB
Step 1: Type “sudo fdisk -l” to check which disk the USB is detect on. (e.g. /dev/sdb1)
Step 2: Create a folder where you want the USB to be mounted on (e.g. /media/usb)
Type “sudo mkdir /media/usb”
All installed packages via apt-get goes into the directory: /var/cache/apt/archives
1. VBox > Settings > Shared Folders and add the folder you want to share inside VM
2. Choose auto mount and permanent if available.
3. check /media inside VM. Does it show /sf_SharedFolderName?
a. if no, install GuestAdditions
b. if yes, you have successfully mounted a shared folder.
How to install Guest Additions
Go here to download http://download.virtualbox.org/virtualbox/
Look for the version and then download the iso
Read this http://docs-v1.vagrantup.com/v1/docs/base_boxes.html
sudo sh /media/cdrom/VBoxLinuxAdditions.run
Eg:
2. Now you need to create a script so that everytime you turn on the vm, you automatically
mound this shared folder to /var/virtual/SharedFolder.
Eg:
sudo nano /etc/init/automountSharedFolder.conf
start on startup
task
Please take note that the gid and uid must match the of the owner of the
/var/virtual/<SharedFolder>
for 14.04
simply do
sudo apt-get install unoconv -y
ssh username@server-ip-address
e.g.,
ssh root@198.61.169.10
https://help.ubuntu.com/community/Postfix
What this is: we want to add a particular user account to the list of sudoers
Your main user is member of group 'sudo'. Default settings is to ask your password in order to
perform any activity which requires some privilegies.
in order to change it, you need to run in a terminal:
sudo visudo
and change this line:
%sudo ALL=(ALL:ALL) ALL
save the changes and close your session to have your system taking the changes.
First we assume that you have already created your private/public key pair
Warning!! Sometimes, you get a host key verification failed message. This means
that probably you change the IP address of the server. Reset your known_hosts
file like this.
Note: for ssh via a different port number like 3022, use
Note: for ssh via a different port number like 3022, use
login as www-data
navigate to /var/virtual
then
cd /boot
sudo rm *-3.03-61-generic
Finally
sudo update-grub
1) you have not updated packages that are held back. You need to update all packages
including those held back
The best way to login to a guest Linux VirtualBox VM is port forwarding. By default you should
have one interface already which is using NAT. Then go to the Network settings and click the
Port Forwarding button. Add new Rule:
Host port 3022, guest port 22, name ssh, other left blank.
It is important all of the above commands are executed. The first is to install. The second adds
`jenkins` to sudoers. The last one is to update the updatecenter so that you can properly use
shortname to install plugins.
echo $SHELL
sudo su www-data
then i do a
echo $SHELL
/bin/sh
instead.
So I did a
chsh -s /bin/bash
Password:
exit
sudo su www-data
I checked the $SHELL again
echo $SHELL
/bin/bash
If i want to know the full path to `service` as in `sudo service php5-fpm restart`
When you try to ssh to a server, sometimes the ip address changes and you get prompted for a
host key verification failed message.
So what you do is you need to reset the known_hosts
ssh-keygen -R hostname
visudo as root
then
type
because sometimes a user needs to mkdir in another dir owned by another user and you do not
wish to change user privileges nor ownership or even which group the user belongs to.
Login as jenkins
Do a
www-data@ipaddress
Compress:
gzip archive.tar
Decompress:
gunzip archive.tar.gz
Merging files
The "z" flag works with gzip, to either create a tar/gzipped archive:
tar -czvf archive.tgz files/
...or decompress a tar/gzipped archive:
tar -xzvf archive.tgz
Update system clock
then
$ sudo do-release-upgrade
if still no release
do
sudo do-release-upgrade -d
taken from
http://www.cyberciti.biz/faq/howto-upgrade-to-ubuntu-14-04-from-ubuntu-13-10-or-12-04/
$ lsb_release -a
$ uname -mrs
$ tail -f /var/log/app/log/file
then reinstall