My Linux Commands
My Linux Commands
df -H
1. Logging Out:
gnome-session-save ?ogout
If the immutable flag is set, there will be an 'i' in the listing. This command is used by system administrators to restrict the users from changing a file in a particular way or even the administrator can by mistake delete a critical file because of a mis-typed command. But if the immutable flag is set, these mistakes can be avoided. chattr can be used to set/unset many more file attributes. Like if you want to allow everybody to just append data to a file and not change already entered data, you can set the append bit as follows: # chattr +a test_file Now the test_file can only be opened in append mode for writing data. You can unset the append attribute as follows: # chattr -a test_file To know more about this very useful tool in the system administrator's forte, check the man page forchattr.
This will ask for a new root password and once you confirm it, you can start using the root account to login. In case you will want to disable back the root account, just lock the root account by running:
sudo passwd -l root
luzar@ubuntu:~$ scp UserManual.pdf luzar@192.168.1.6:. luzar@192.168.1.6's password: UserManual.pdf 100% 3812KB luzar@ubuntu:~$
3.7MB/s
00:01
The scp command example above shows I am sending a file named UserManual.pdf from my computer to a remote computer with an ip address 192.168.1.6. The file UserManual.pdf must be in our home directory. If not, please provide a complete directory path. The file will be saved in luzar's home directory. I specified the user name which I want to login with (remember that we need to provide a valid username and password) and enter the password afterward. Here is the example on how to retrieve file from a remote computer using scp command in Linux. This time we are using remote server's hostname:
luzar@ubuntu:~$ scp luzar@slackware:/home/luzar/netfilter.pdf . luzar@slackware's password: netfilter.pdf 100% 367KB 367.2KB/s luzar@ubuntu:~$ 00:00
The scp command example above shows that I was retrieving a file named netfilter.pdf from a remote computer with an ip address 192.168.1.6. Notice that this time I used a full directory path to the file which I want to get. We can also use scp command to transfer multiple files at once to a remote computer. See the example below:
luzar@ubuntu:~$ scp Interfaces.txt new_file02.txt labu@10.21.36.3:. Password: Interfaces.txt 100% 268 0.3KB/s new_file02.txt 100% 51 0.1KB/s luzar@ubuntu:~$ 00:00 00:00
We can also use wild card with scp command such as * to copy all files. If you feel that copying the whole directory is a better idea, here is an example of scp command used to transfer a directory to a remote computer:
luzar@ubuntu:~$ scp -r folder labu@10.21.36.3:. Password: luzar@ubuntu:~$
We use scp -r option in the example above to recursively copying a directory named folder. You can also use scp command to transfer file or directory to other Linux computer using Windows operating system. Get Putty to login to the Linux server and use scp to copy file or directory to a remote computer (Linux computer) just as examples above. Adding Proxy Adding system wide proxy
Edit the file /etc/environment, for example with this command: gksu /etc/environment (it will ask you for your password, because you need to do it as a root)
now, add the following line to that file: http_proxy="http://my.proxy.address:port" where 'my.proxy.address' and 'port' need to be replaced with the respective values you wish to use. Save the file and relog -- make sure the setting is there by opening a terminal and ussuing the command: export | grep http_proxy You might be also interested in the fact that apt (the application that performs the installation of packages in Ubuntu) has some support for proxy. Edit Nano /etc/apt/apt.conf add for example Acquire::http::proxy "http://192.168.170.25:3135/"; Acquire::ftp::proxy "ftp://192.168.170.25:3135/"; Acquire::https::proxy "https://192.168.170.25:3135/";