Markus Blog What's going on Internet?

25Jun/072

Customizing Bash Prompt

I install several servers 2 days ago, what I found after I login to SSH is that the bash prompt is different with my older server, it only show “bash-3.1#” instead of “[username@servername – directory] $”

I found “bash-3.1#” is difficult as I don’t know my current directory location. With a little bit Google search I get an answer.

You can customize your bash prompt by creating a file named .bash_profile (there is a “dot” in front of the filename)

Insert this code in .bash_profile file:

export PS1="[u@h w]$ "

now your bash prompt will look like this:

[user@localhost /home/user]$
25Jun/072

Creating Empty File with Specified Size

If you want to do some download speed test, you can create a dummy file which have specific file size. To create an empty file with size you want type this command:

dd if=/dev/zero of=10mb-file.bin bs=1024k count=10

The command above will create a 10 MB sized file. If you want to create another file with different size, change the number after “count=”. Any number given after “count=” will be multiplied by 1024k or 1MB.

25Jun/0711

Transferring Files from Remote Server to Remote Server Using SCP

If you have more than one server and want to transfer files between the two, you can use SCP (Secure Copy). Here is how to do it:

$ scp /folder/file-to-tranfer username@remote.host.net:/folder/file-destination-name

SCP then will ask the password for username on the remote host that already specified, insert the username and press enter. Wait until the transfer finished and your file will be copied to the destination server.

23Jun/070

Disable Shell Access

If you want to create a user on your server but doesn't want to give him SSH access then you can run this command to disable his shell:

usermod -s /bin/false username

After running that command, the user specified will not have SSH access but still can do other things like FTP.

22Apr/071

Problem with Date and Time Zone in CentOS 4.4

Last night I was configuring my new server and having trouble with changing the time zone. I use dateconfig command to change the time zone, I select "Asia/Jakarta" and save the configuration.

Strange thing is the time zone configuration is wrong, instead of WIT the time zone used is UTC. I tried to change the time zone again, this time I didn't use dateconfig but by creating a symlink from /usr/share/zoneinfo/Asia/Jakarta to /etc/localtime, it doesn't work either.

Page 5 of 512345