通常的ubuntu有以下几个版本,第一步是找到终端的位置:
Starting a TerminalIn Gnome (Ubuntu)The terminal can be found atApplications menu->Accessories->Terminal.In Xfce (Xubuntu)The terminal can be found atApplications menu->System->Terminal.In KDE (Kubuntu)The terminal can be found atKMenu->System->Terminal Program (Konsole).
第二步,当然是相应的命令了:
Commandssudo: Executing Commands with Elevated Privileges 执行命令特权 sudo是允许系统管理员让普通用户执行一些或者全部的root命令的一个工具,如halt,reboot,su等等。这样不仅减少了root用户的登陆 和管理时间,同样也提高了安全性。Sudo不是对shell的一个代替,它是面向每个命令的。(ps:王朝里已经有sudo的相关搜索,感兴趣的可以去看看。)
Most of the following commands will need to be prefaced with thesudocommand if you will be working with directories or files not owned byyour account. This is a special command which temporarily gives youaccess to change computer settings. The terminal will ask you for yourpassword. Please see RootSudo for information on using sudo.
File & Directory Commands 针对文件和目录的命令pwd(显示当前位置): Thepwdcommand will allow you to know in which directory you're located (pwdstands for "print working directory"). Example:"pwd"in the Desktop directory will show "~/Desktop". Note that the GnomeTerminal also displays this information in the title bar of its window.
ls(列出详细资料): Thelscommand will show you the files in your current directory. Used withcertain options, you can see sizes of files, when files were made, andpermissions of files. Example:"ls ~"will show you the files that are in your home directory.
cd(进入目录): Thecdcommand will allow you to change directories. When you open a terminalyou will be in your home directory. To move around the file system youwill usecd. Examples:
To navigate into the root directory, use"cd /"
To navigate to your home directory, use"cd"or"cd ~"
To navigate up one directory level, use"cd .."
To navigate to the previous directory (or back), use"cd -"
Tonavigate through multiple levels of directory at once, specify the fulldirectory path that you want to go to. For example, use,"cd /var/www"to go directly to the /www subdirectory of /var/. As another example,"cd ~/Desktop"will move you to the Desktop subdirectory inside your home directory.
cp(复制): Thecpcommand will make a copy of a file for you. Example:"cp file foo"will make a exact copy of "file" and name it "foo", but the file "file"will still be there. If you are copying a directory, you must use"cp -r directory foo"(copy recursively).
mv(移动): Themvcommand will move a file to a different location or will rename a file. Examples are as follows:"mv file foo"will rename the file "file" to "foo"."mv foo ~/Desktop"will move the file "foo" to your Desktop directory but will not rename it. You must specify a new file name to rename a file.
To save on typing, you can substitute '~' in place of the home directory. Note that if you are usingmvwithsudoyou can use the ~ shortcut, because the terminal expands the ~ to yourhome directory. However, when you open a root shell withsudo -iorsudo -s, ~ will refer to the root account's home directory, not your own.
rm(删除文件): Use this command to remove or delete a file in your directory.
rmdir(删除目录): Thermdircommand will delete anemptydirectory. To delete a directory and all of its contents recursively, userm -rinstead.
mkdir(创建目录): Themkdircommand will allow you to create directories. Example:"mkdir music"will create a directory called "music".
man(帮助): Themancommand is used to show you the manual of other commands. Try"man man"to get the man page formanitself. See the "Man& Getting Help" section down the page for more information.System Information Commands 系统信息命令df(显示文件系统中还有多少剩余空间): Thedfcommand displays filesystem disk space usage for all mounted partitions. "df -h" is probably the most useful - it uses megabytes (M) and gigabytes (G) instead of blocks to report. (-hmeans "human-readable")
du(显示目录中文件或目录的具体大小): Theducommand displays the disk usage for a directory. It can either displaythe space used for all subdirectories or the total for the directoryyou run it on. Example: (以floppy文件夹为例)
user@users-desktop:~$ du /media/floppy
1032 /media/floppy/files
1036 /media/floppy/
user@users-desktop:~$ du -sh /media/floppy
1.1M /media/floppy/(-smeans "Summary" and-hmeans "Human Readable")
free(显示已用和剩余的空间大小): Thefreecommand displays the amount of free and used memory in the system."free -m"will give the information using megabytes, which is probably most useful for current computers.
uname -a(显示所有的系统信息): Theunamecommand with the-aoption prints all system information, including machine name, kernelname & version, and a few other details. Most useful for checkingwhich kernel you're using.
lsb_release -a(显示当前用的版本): Thelsb_releasecommand with the-aoption prints version information for the Linux release you're running, for example:
user@computer:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 6.06 LTS
Release: 6.06
Codename: dapperifconfig(报告系统的网络状态) reports on your system's network interfaces.
ps:小弟我也是刚刚接触ubuntu,对于终端的命令只是知道简单的几个。但是不能原地踏步,所以整理一下与各位共享。