Ubuntu/Linux cli syntax

Command line interface syntax for various actions

Make new directory, make [directory_name]

sudo mkdir new_directory

Remove (file or directory)

rm [name]

rm -i file_to_remove.txt

Using -i prompts you to confirm the deletion.
Remove directory and all of its contents without having to confirm. Obviously be careful.
[/bash]sudo rm -r directory_to_remove[/bash]

Move a file

mv [name] [new_location]

mv file.txt new_sub_directory/file.txt

Rename a file (similar to moving)
mv [name] [new_name]

mv file.txt new_file_name.txt

Copy a fold

cp -r [folder]/* [new_location]

cp -r folder/* /some_place/else/

Keep ssh sessions live

If you want to stop your SSH sessions from being shut down you can add the following line to /etc/ssh/ssh_config on your local machine.

sudo gedit /etc/ssh/ssh_config

Then add:

ServerAliveInterval 30

This does remove the security feature of closing your session in case you leave your computer, but you may decide to take that risk. This sends a SSH package every 30 seconds so your server doesn’t close the connection due to inactivity.

Edit DNS Name Server

Set the DNS name server to use for your machine.

sudo nano /etc/resolv.conf

Then you can use for example ( is Google public DNS, is OpenDNS):

sudo lshw

will provide infor on your system, CPU types, 32 v 64 bit…

1 thought on “Ubuntu/Linux cli syntax

  1. Pingback: Linux/Ubuntu File and Directory Permissions | Coding and Server Syntax Examples

Leave a Reply

Your email address will not be published. Required fields are marked *

This Blog will give regular Commentators DoFollow Status. Implemented from IT Blögg