Roshan Book

My Tech Notebook

Tag Archives: terminal commands

ubuntu terminal commands


Restart Apache              : sudo /etc/init.d/apache2 restart

Starting Apache :sudo /etc/init.d/apache2 start

Stopping Apache          : sudo /etc/init.d/apache2 stop

Copy A File

sudo cp /home/manishroshan/backups/123.tar.gz /var/www/downloads
Copies a file from one directory to another directory. (in this case the file1 23.tar.gz was copied to the /var/www/downloads directory).
If you don’t want to copy but move the file, change cp to mv.

Downloading a file from a url


Execute multiple commands

command 1 && command 2

File Browsing

Into the directory :  cd directoryName

Outside directory : cd

Making a folder writable

sudo chmod 777 -R /opt


IP Config : ifconfig

Ping         : ping

Installing a Package

sudo apt-get install PackageName

Installing ZF tool with auto configuration with one command

sudo apt-get install zend-framework-bin

Listening to port and killing a program

netstat -natp | grep LISTEN

kill pidNo

Terminal Shortcuts

Up Arrow or ctrl+p Scrolls through the commands you’ve entered previously.
Down Arrow or ctrl+n Takes you back to a more recent command.
Enter When you have the command you want.
tab A very useful feature. It autocompletes any commands or filenames, if there’s only one option, or else gives you a list of options.
ctrl+r Searches for commands you’ve already typed. When you have entered a very long, complex command and need to repeat it, using this key combination and then typing a portion of the command will search through your command history. When you find it, simply press Enter.
History The history command shows a very long list of commands that you have typed. Each command is displayed next to a number. You can type !x to execute a previously typed command from the list (replace the X with a number). If you history output is too long, then use history | less for a scrollable list.


tar -zxfv filename.gz


%d bloggers like this: