Commands Useful for Linux Novices

Source: Internet
Author: User
Keywords linux linux sentence linux commands
1. ls command
The ls command means to list the contents of the directory (List Directory Contents). To run it is to list the contents of the folder, which may be a file or a folder.

root@tecmint:~# ls

Android-Games Music
Pictures Public
Desktop Tecmint.com
Documents TecMint-Sync
Downloads Templates
The "ls -l" command lists the contents of the folder in long listing fashion.

root@tecmint:~# ls -l

total 40588
drwxrwxr-x 2 ravisaive ravisaive 4096 May 8 01:06 Android Games
drwxr-xr-x 2 ravisaive ravisaive 4096 May 15 10:50 Desktop
drwxr-xr-x 2 ravisaive ravisaive 4096 May 16 16:45 Documents
drwxr-xr-x 6 ravisaive ravisaive 4096 May 16 14:34 Downloads
drwxr-xr-x 2 ravisaive ravisaive 4096 Apr 30 20:50 Music
drwxr-xr-x 2 ravisaive ravisaive 4096 May 9 17:54 Pictures
drwxrwxr-x 5 ravisaive ravisaive 4096 May 3 18:44 Tecmint.com
drwxr-xr-x 2 ravisaive ravisaive 4096 Apr 30 20:50 Templates
The "ls -a" command will list all the contents of the folder, including hidden files beginning with ".".

root@tecmint:~# ls -a

. .gnupg .dbus .goutputstream-PI5VVW .mission-control
.adobe deja-dup .grsync .mozilla .themes
.gstreamer-0.10 .mtpaint .thumbnails .gtk-bookmarks .thunderbird
.HotShots .mysql_history .htaccess .apport-ignore.xml .ICEauthority
.profile .bash_history .icons .bash_logout .fbmessenger
.jedit .pulse .bashrc .liferea_1.8 .pulse-cookie
.Xauthority .gconf .local .Xauthority.HGHVWW .cache
.gftp .macromedia .remmina .cinnamon .gimp-2.8
.ssh .xsession-errors .compiz .gnome teamviewer_linux.deb
.xsession-errors.old .config .gnome2 .zoncolor
Note: In Linux, files beginning with "." are hidden files, and each file, folder, device or command is treated as a file. ls -l command output:

d (represents a directory).
rwxr-xr-x is the authority of the file or directory to the user, the same group of users and other users.
The first ravisaive in the above example represents the file belongs to the user ravisaive
The second ravisaive in the above example represents that the file belongs to the user group ravisaive
4096 means the file size is 4096 bytes.
May 8 01:06 represents the date and time when the file was last modified.
The last one is the name of the file/folder
For more "ls" examples, please see 15 Examples of ls command in linux

LianyouCQ
LianyouCQ
Translated on 2013/08/08 10:10
 
Other translated versions (1)
2. lsblk command
"lsblk" is to list block devices. In addition to RAM, block devices are displayed neatly in a standard tree output format.

root@tecmint:~# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 46.6G 0 part /
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 190M 0 part /boot
├─sda6 8:6 0 3.7G 0 part [SWAP]
├─sda7 8:7 0 93.1G 0 part /data
└─sda8 8:8 0 89.2G 0 part /personal
sr0 11:0 1 1024M 0 rom
The "lsblk -l" command displays block devices in a list format (rather than a tree format).

root@tecmint:~# lsblk -l

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
sda1 8:1 0 46.6G 0 part /
sda2 8:2 0 1K 0 part
sda5 8:5 0 190M 0 part /boot
sda6 8:6 0 3.7G 0 part [SWAP]
sda7 8:7 0 93.1G 0 part /data
sda8 8:8 0 89.2G 0 part /personal
sr0 11:0 1 1024M 0 rom
Note: lsblk is the most useful and easiest way to know the name of a newly inserted USB device, especially when you are dealing with disk/block devices on the terminal.

3. md5sum command
"Md5sum" is to calculate and verify the MD5 message signature. md5 checksum (usually called hash) uses matching or verification of file integrity, because files may be changed due to transmission errors, disk errors, or non-malicious interference.

root@tecmint:~# md5sum teamviewer_linux.deb

47790ed345a7b7970fc1f2ac50c97002 teamviewer_linux.deb
Note: Users can use the official provided and md5sum to generate signature information matching to detect whether the file has changed. Md5sum is not as safe as sha1sum, which we will discuss later.

LianyouCQ
LianyouCQ
Translated on 2013/08/08 10:28
 
4. dd command
The "dd" command represents converting and copying files. Can be used to convert and copy files, most of the time is used to copy iso files (or any other files) to a usb device (or any other place), so it can be used to make a USB boot device.

root@tecmint:~# dd if=/home/user/Downloads/debian.iso of=/dev/sdb1 bs=512M; sync
Note: In the above example, the usb device is sdb1 (you should use the lsblk command to verify it, otherwise you will rewrite your disk or system). Please use the disk name carefully and avoid it.

The dd command will consume from a few seconds to a few minutes depending on the size and type of the file and the reading and writing speed of the usb device.

LianyouCQ
LianyouCQ
Translated at 2013/08/08 10:39
 
5. uname command
The "uname" command is short for Unix Name. Display the detailed information of the machine name, operating system and kernel.

root@tecmint:~# uname -a

Linux tecmint 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:36:13 UTC 2013 i686 i686 i686 GNU/Linux
Note: uname displays the kernel category, uname -a displays detailed information. The above output details uname -a

"Linux": the kernel name of the machine
"Tecmint": the node name of the machine
"3.8.0-19-generic": kernel release version
"#30-Ubuntu SMP": Kernel version
"I686": processor architecture
"GNU/Linux": Operating system name
6. history command
The "history" command is history. It shows the history of all the commands executed in the terminal.

root@tecmint:~# history

 1 sudo add-apt-repository ppa:tualatrix/ppa
 2 sudo apt-get update
 3 sudo apt-get install ubuntu-tweak
 4 sudo add-apt-repository ppa:diesch/testing
 5 sudo apt-get update
 6 sudo apt-get install indicator-privacy
 7 sudo add-apt-repository ppa:atareao/atareao
 8 sudo apt-get update
 9 sudo apt-get install my-weather-indicator
 10 pwd
 11 cd && sudo cp -r unity/6 /usr/share/unity/
 12 cd /usr/share/unity/icons/
 13 cd /usr/share/unity
Note: Press and hold "CTRL + R" to search for commands that have been executed, and it can automatically complete when you write a command.

(reverse-i-search)`if': ifconfig
LianyouCQ
LianyouCQ
Translated at 2013/08/08 12:57

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.