Linux Basic Commands
Linux Command - Advanced
Advanced Linux Commands
1. How to create large file a TXT of 1GB for testing purposes by linux command?
$dd if=/dev/zero of=file.txt count=1024 bs=1048576
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 17.1951 s, 62.4 MB/s
2. To see if the Ubuntu machine is 32 or 64 bit
#uname -a
- for 32bit: Linux frobov-komp 3.2.0-63-generic #95-Ubuntu SMP Thu May 15 23:06:36 UTC 2014 i686 i686 i386 GNU/Linux
- for 64bit: Linux discworld 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
#uname -m
i686
3. Modifing long bash prompt
For example: frob@frobov-komp:/homemiko/com_webdevelopment-tutorials/www/public_html/code/smiko/database$
PS1=\\u@\\h\ \\w\\n\\$\ -prompt in separate line
PS1="\u - \W $ " gives only frob - mongodb$
* \a : an ASCII bell character (07)
* \d : the date in "Weekday Month Date" format (e.g., "Tue May 26")
* \D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
* \e : an ASCII escape character (033)
* \h : the hostname up to the first '.'
* \H : the hostname
* \j : the number of jobs currently managed by the shell
* \l : the basename of the shell’s terminal device name
* \n : newline
* \r : carriage return
* \s : the name of the shell, the basename of $0 (the portion following the final slash)
* \t : the current time in 24-hour HH:MM:SS format
* \T : the current time in 12-hour HH:MM:SS format
* \@ : the current time in 12-hour am/pm format
* \A : the current time in 24-hour HH:MM format
* \u : the username of the current user
* \v : the version of bash (e.g., 2.00)
* \V : the release of bash, version + patch level (e.g., 2.00.0)
* \w : the current working directory, with $HOME abbreviated with a tilde
* \W : the basename of the current working directory, with $HOME abbreviated with a tilde
* \! : the history number of this command
* \# : the command number of this command
* \$ : if the effective UID is 0, a #, otherwise a $
* \nnn : the character corresponding to the octal number nnn
* \\ : a backslash
* \[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
* \] : end a sequence of non-printing characters
If you want permanently change your prompt edit ~/.bashrc file :
In Ubuntu 12.04
# PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS1="\u - \W $ "
After that restart with $source ~/.bashrc or just $ . ~/.bashrc
4. Midnight Commander
Midnight commander is a file browser like Norton Commander .
#apt-get install mc
Start Midnight commander with #mc .