Skip to content

Instantly share code, notes, and snippets.

@wolf-mtwo
Last active August 29, 2015 14:09
Show Gist options
  • Save wolf-mtwo/d2a08170735da52fa27f to your computer and use it in GitHub Desktop.
Save wolf-mtwo/d2a08170735da52fa27f to your computer and use it in GitHub Desktop.
Easy commands Ubuntu 14

installation and easy exlamples

sudo apt-get install openssh-server openssh-client
apt-get update
apt-get install docker.io



sudo docker run -i -t ubuntu /bin/bash
Which should download the ubuntu image, and then start bash in a container.

uname -a
Linux cb08e20bed23 3.13.0-24-generic 

apt-get update
apt-get install nodejs

docker commit 00000000 simulator/nodejs

apt-get install npm

docker commit 00000000 simulator/npm

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
apt-get install -y mongodb-org

/var/lib/mongodb
/var/log/mongodb
/etc/mongod.conf

service mongod start


# export and import images
docker save mynewimage > /tmp/mynewimage.tar
docker load < /tmp/mynewimage.tar

How To Install Node.js on an Ubuntu 14.04 server

sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm

SSH client - server

sudo apt-get install openssh-server openssh-client
ssh localhost

copy files from server to server

cp -R folder-clone data_block_v0.1
tar -cvzf data_block_v0.1.tar.gz data_block_v0.1
scp data_block_v0.1.tar.gz wolf@0.0.0.0:/wolf

###other size

tar -xvf data_block_v0.1.tar.gz`
```

donot ask for password

sudo visudo
wolf  ALL=(ALL) NOPASSWD: ALL

cron

// export VISUAL=vim
// crontab -e
// */1 * * * * mongo test /wolf/demo.js >> /wolf/change.log

server time

sudo dpkg-reconfigure tzdata

enable DHCP client

$ sudo dhclient eth0

Install docker

$ curl -sSL https://get.docker.com/ubuntu/ | sudo sh

How to restart the networking service?

sudo service networking restart
sudo /etc/init.d/network restart

procesos

$ ps -ef | grep node
$ sudo netstat -nap | grep 80

Ubuntu - Easy commands

Cd

$ cd filename 
$ cd filename/new/folder 
$ cd .. # go back
$ cd    # go home
$ cd ~
$ cd /  # go root

Sudo

$ sudo -s # change to root

Wall

$ echo "message" | wall

Disable firewall

$ sudo ufw disable

Zip

$ zip -r zipfile.zip directory #-r aply to folder three
install
$ sudo apt-get install unzip
$ unzip filename.zip
$ unzip file.zip -d /Dir
$ sudo unzip file.zip -d /rootDir

Tar

$ tar cvzf MyImages-14-09-12.tar.gz /home/MyImages
OR
$ tar cvzf MyImages-14-09-12.tgz /home/MyImages

Untar

$ tar -xvf public_html-14-09-12.tar
$ tar -xvf public_html-14-09-12.tar -C /home/public_html/videos/

Scp

Copy files from server to server

$ scp source_file_name username@destination_host:destination_folder   # from local to remote
$ scp demo.tar.gz root@0.0.0.0:~
$ scp username@destination_host:destination_folder .                  # from remote to local
$ scp username@destination_host:destination_folder source_file_name   # to local path

cp

cp -R folder

¿Donde estoy parado?

$ pwd  

(que significa "print working directory", y en castellano? imprimir el directorio en el que estoy trabajando )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment