Relevant to your use, you can either choose to make it a permanent addition or a temporary addition. Lets take an example of changing the MAC address of interface eth0 to 11:22:33:44:44:66
$ sudo ifconfig eth0 down
$ sudo ifconfig eth0 hw ether 11:22:33:44:55:66
$ sudo ifconfig eth0 up
1. Open /etc/network/interfaces ,
$ sudo vim /etc/network/interfaces
2. Add an extra line to specify the new MAC
iface eth0 inet dhcp
hwaddress ether 01:02:03:04:05:06
(A simple configuration, additional configurations will require additions/alterations. E.g. static IP/different interface)
3. Restart the network service
$ /etc/init.d/networking restart
Though the the latest version of Ubuntu may require you to use the service command to start/stop/restart services
I just recently discovered that one can search a history of commands(in BASH) in a few keystrokes , rather than the ancient way of pressing the up arrow till you see it or eventually doze off 🙂
Press Ctrl + R
Start typing the command u want to search for( it starts autocompleting)
Once you reach the right command -> Type Enter
Happy Searching 🙂
scp stands for secure cp (copy), which means that you can copy files across an ssh connection that will be encrypted, and therefore secured.
You can this way copy files from or to a remote server, you can even copy files from one remote server to another remote server.
scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]
Description of options
- Is the name or IP of the host where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command
- Is the user which have the right to access the file and directory that is supposed to be copied in the cas of the from-host and the user who has the rights to write in the to-host
- Is the file or files that are going to be copied to the destination host, it can be a directory but in that case you need to specify the -r option to copy the contents of the directory
- Is the name that the copied file is going to take in the to-host, if none is given all copied files are going to maintain its names
- Preserves the modification and access times, as well as the permissions of the source-file in the destination-file
- Do not display the progress bar
- Recursive, so it copies the contents of the source-file (directory in this case) recursively
- Displays debugging messages
scp *.txt firstname.lastname@example.org:/home/user/
This will copy all files with .txt extension to the directory /home/user in the remote.server.com host
scp -r email@example.com:/home/miguel/ firstname.lastname@example.org:/home/miguel/
This is going to recursively copy all files from miguel’s Home directory on 10.1.2.2 host to his Home directory in 10.1.2.3 host.
To use this command you need to have open-ssh installed in the hosts.
dpkg is a tool to install, build, remove and manage packages. dpkg itself is controlled entirely via command line parameters
To install package called package.deb type the following command:
Go to directory where package.deb is kept. For example if it is in /tmp directory:
$ cd /tmp
Type the following command:
$ sudo dpkg -i package.deb
Create tape archives and add or extract files.
Note: A “.tar” file is not a compressed files, it is actually a collection of files within a single file uncompressed. If the file is a .tar.gz (“tarball“) or “.tgz” file it is a collection of files that is compressed. If you are looking to compress a file you would create the tar file then gzip the file.
Creating a tar file:
tar -cvvf file.tar myfile.txt
In the above example the system would create a tar named file.tar in the directory you currently are in. Wildcards could also be used in this command, for example: tar -cvvf file.tar *.txt would compress all txt files in the current directory.
tar -cvvf home.tar home/
In the above example command the system would create a tar file named home.tar in the directory you currently are in of the home directory.
Extracting the files from a tar file:
tar -xvvf myfile.tar
In the above example command the system would uncompress (untar) the myfile.tar file in the current directory.
tar -xvvzf myfile.tar.gz
In the above example command the system would uncompress (untar) the myfile.tar.gz file in the current directory.
Note: There is no “untar” linux / unix command.
Creating a tarred file that is compressed with bzip
tar -cjvf test.tbz home/
Adding the j option to the tar command enables tar to compress files and/or directories using bzip. In the above example the home directory and all its subdirectories are added to the compressed test.tbz file.