免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 546 | 回复: 0
打印 上一主题 下一主题

Basic Linux Commands [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-04-11 11:16 |只看该作者 |倒序浏览

原文:http://www.reallylinux.com/docs/basic.shtml
Basic Linux Commands
This list comes courtesy of Mark Rais, senior editor reallylinux.com
NOTICE this is ONLY the Basic list. I also offer a list of commands for:
Beginning Server Administration
Files and Permissions
Directory navigation
Commands for Guru-Wannabees

TIP 1:
All of these commands should work from your command prompt (regardless which shell you're using). Just in case some folks were not aware, you MUST press enter to invoke the command
TIP 2:
For this summary, please note that the EX: stands for example and is not part of the command. Commands are denoted in courier type font.
TIP 3:
If you need help understanding what the options are, or how to use a command, try adding this to the end of your command: --help
For example, for better understanding of the df command's options, type:
df --help
Command
Summary Use
Use cd to change directories
Type cd followed by the name of a directory to access that directory.
Keep in mind that you are always in a directory and allowed access to any directories hierarchically above or below. Ex:
cd games
If the directory games is not located hierarchically below the current directory, then the complete path must be written out. Ex:
cd /usr/games
To move up one directory, use the shortcut command. Ex:
cd ..
Use clear to clear the command prompt
Type clear to clean up your command prompt window.
This is especially helpful when you are typing lots of commands and need a clean window to help you focus.Ex:
clear
This is also useful when you are getting ready to type a rather long command and do not wish to become confused by other details on the screen.
Use date to set your server's date and time
Type date followed by the two digit month, the two digit date, the two digit time, and two digit minutes. The syntax is easy enough and resembles this: MMDDhhmm
This command is helpful but must be used when superuser or logged in as root. Otherwise you will get an "Operation not permitted" reply.As root user you can use the command such as:
date 11081300
The above command will set the server date and time to the 11th month (November), the 8th day, at 1:00pm.
Use df to check disk space
Typing df provides a very quick check of your file system disk space.
Type df -h to get a more easily readable version of the output. Notice that this command will include all applicable storage such as your hard disk/s (hda, hdb etc.) and your server SWAP file (shm). To list disk space including filesystem type:
df -h -T
Use finger to see who's on the system
Typing finger allows you to see who else is on the system or get detailed information about a person who has access to the system.
Type finger followed by the name of a user's account to get information about that user. Or, type finger and press enter to see who's on the system and what they are doing. Ex:
finger johndoe
Use logout to quit using the system
Yep, you guessed it, typing logout will log your account out of the system.
Type logout at the prompt to disconnect from your Linux machine or to logout a particular user session from the system. Keep in mind that although rudimentary, leaving your critical account logged on may be a security concern. We always recommend promptly using logout when you are finished using your root account! Ex:
logout
Use ls to list files and directories
Type ls to see a list of the files and directories located in the current directory. If you’re in the directory named games and you type ls, a list will appear that contains files in the games directory and sub-directories in the games directory. Examples:
ls Mail
ls /usr/bin
Type ls -alt to see a list of all files (including .rc files) and all directories located in the current directory. The listing will include detailed, often useful information. Examples:
ls -alt
ls -alt /usr/bin
If the screen flies by and you miss seeing a number of files, try using the |more at the end like:
ls -alt |more
* In Bash (Linux shell) often the abbreviated command L is available. To get a verbose listing of files and directories you could therefore simply type: l

Use man to pull up information about a Linux command
Type man followed by a command to get detailed information about how to use the command. Ex:
man ls
Type man -k followed by a word to list all of the commands and descriptions that contain the word you specified. Ex:
man -k finger
Use more to read the contents of a file
Type more followed by the name of a text file to read the file’s contents. Why do we exmphasize using this on a "text" file? Because most other types of files will look like garbage! Ex:
more testfile.txt
Use nano to start a text editor
Typing nano will start a basic text editor on most Linux systems.
Type nano followed by the filename you wish to edit. This basic editor is quick and easy to use for beginners. However, it is very important that you also learn about other text editors available on Linux and UNIX systems. Click
on this link
to learn about others like emacs, vi, and pico. Ex:
nano /etc/security/access.conf
Use passwd to change your current password
Type passwd and press enter. You'll see the message Changing password for yourname.
At the Old password: prompt, type in your old password .
Then, at the Enter new password: prompt, type in your new password .
The system double checks your new password. Beside the Verify: prompt, type the new password and press again.
Create a secure password that combines parts of words and numbers. For instance, your dog's name may be Rufus. He may have been born in 1980. Create a password that uses parts of both the name and date of birth, such as 80rufuS. Note the use of at least one capital letter. This is a fairly secure password and easy to remember.
Use pwd to list the name of your current directory
Type pwd and hit enter. You'll see the full name of the directory you are currently in. This is your directory path and is very handy. This is especially handy when you forget which directory you’ve changed to and are trying to run other commands.


Want more? Perhaps you're ready for our
Commands for Guru Wanna-bees
or review the
Beginner commands for Server Administration
.


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/19412/showart_275449.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP