slitaz-doc-wiki-data annotate pages/en/handbook/commands.txt @ rev 140

Add TazPanel to en:handbook:networkconf
author Christian Mesh meshca@clarkson.edu
date Mon Mar 19 21:55:06 2012 +0000 (2012-03-19)
parents 70b5f3ae5339
children
rev   line source
slaxemulator@7 1 ====== Command Line Reference ======
slaxemulator@7 2
slaxemulator@7 3 ===== Introduction to the commands =====
slaxemulator@7 4
slaxemulator@7 5 This document is intended as a quick reference for using commands on SliTaz via a Linux terminal or a graphical terminal (xterm). There are many GNU/Linux commands for file handling, system maintenance or network management. You can also browse the web, chat on IRC, download files, edit scripts or even play games in text mode. Note it is necessary to operate as root to assemble the hard drive or cdrom. You can use the command //su// to become system administrator.
slaxemulator@7 6
slaxemulator@7 7 ===== Help and list available commands =====
slaxemulator@7 8
slaxemulator@7 9 Most GNU/Linux system commands have an option for providing information on their use. For support on the use of a command, it is necessary to type the command followed by the <nowiki>--help </nowiki> option. Example using the cp command to copy files:
slaxemulator@7 10
slaxemulator@7 11 <code> $ cp --help </code>
slaxemulator@7 12
slaxemulator@7 13 To list all the commands available on the system, you can simply press the Tab button on the left of the keyboard twice. For commands provided by the Busybox utility you can type
slaxemulator@7 14 <code> busybox --help. </code>
slaxemulator@7 15
slaxemulator@7 16 ===== List the files in a directory =====
slaxemulator@7 17
slaxemulator@7 18 To list the files and folders contained in a directory, you can use the ls command. For all options remember to use the --help flag. To simply list the files in the current directory:
slaxemulator@7 19
slaxemulator@7 20 <code> $ ls </code>
slaxemulator@7 21
slaxemulator@7 22 List all the files using the -al option:
slaxemulator@7 23
slaxemulator@7 24 <code> $ ls -al </code>
slaxemulator@7 25
slaxemulator@7 26 List a directory:
slaxemulator@7 27
slaxemulator@7 28 <code> $ ls /home/slitaz </code>
slaxemulator@7 29
slaxemulator@7 30 ===== Moving around directories =====
slaxemulator@7 31
slaxemulator@7 32 To browse to the files, you can use the //cd// command:
slaxemulator@7 33
slaxemulator@7 34 <code>
slaxemulator@7 35 $ cd /usr/share/doc
slaxemulator@7 36 Back to the parent directory:
slaxemulator@7 37 $ cd ..
slaxemulator@7 38 </code>
slaxemulator@7 39
slaxemulator@7 40 To go into the directory of the user (//root = /root//):
slaxemulator@7 41
slaxemulator@7 42 <code>
slaxemulator@7 43 $ cd
slaxemulator@7 44 Or :
slaxemulator@7 45 $ cd ~
slaxemulator@7 46 Or :
slaxemulator@7 47 $ cd $HOME
slaxemulator@7 48 </code>
slaxemulator@7 49
slaxemulator@7 50 ===== Copy files =====
slaxemulator@7 51
slaxemulator@7 52 The //cp// command copies files or folders. The example copies the info.txt file in the current directory into the Documents directory:
slaxemulator@7 53
slaxemulator@7 54 <code> $ cp info.txt Documents/ </code>
slaxemulator@7 55
slaxemulator@7 56 Copy a whole directory. Here the command copies the Templates directory into /home/hacker:
slaxemulator@7 57
slaxemulator@7 58 <code> $ cp -a Templates /home/hacker </code>
slaxemulator@7 59
slaxemulator@7 60 ===== Move (rename) files or directories =====
slaxemulator@7 61
slaxemulator@7 62 The mv command takes the contents of a file and copies it to a new file, then deletes the original file:
slaxemulator@7 63
slaxemulator@7 64 <code> $ mv file1 file2 </code>
slaxemulator@7 65
slaxemulator@7 66 It can also rename directories (provided the new directory doesn't exist):
slaxemulator@7 67
slaxemulator@7 68 <code> $ mv ~/Documents ~/Docs </code>
slaxemulator@7 69
slaxemulator@7 70 Move files (and directories) to a new directory:
slaxemulator@7 71
slaxemulator@7 72 <code> $ mv file1 file2 dir1 dir2 ~/Documents </code>
slaxemulator@7 73
slaxemulator@7 74 ===== Create a new file =====
slaxemulator@7 75
slaxemulator@7 76 The touch command can create a new empty file:
slaxemulator@7 77
slaxemulator@7 78 <code> $ touch newfile </code>
slaxemulator@7 79
slaxemulator@7 80 ===== Create a new directory =====
slaxemulator@7 81
slaxemulator@7 82 This command will create a new directory. The following command creates a directory called Projects. It will be created in the directory ///home// of the current user or in the directory which one is in. Note you can display your current working directory with the //pwd// command:
slaxemulator@7 83
slaxemulator@7 84 <code> $ mkdir Projects </code>
slaxemulator@7 85
slaxemulator@7 86 Creation of a directory named script-1.0 in the Projects folder:
slaxemulator@7 87
slaxemulator@7 88 <code> $ mkdir Projects/script-1.0 </code>
slaxemulator@7 89
slaxemulator@7 90 You can also create a directory tree with the -p parents option:
slaxemulator@7 91
slaxemulator@7 92 <code> $ mkdir -p one/two/three/four </code>
slaxemulator@7 93
slaxemulator@7 94 ===== Delete files or directories =====
slaxemulator@7 95
slaxemulator@7 96 The command //rm// lets you delete a file. Let's remove the file work.txt which is in the current directory:
slaxemulator@7 97
slaxemulator@7 98 <code> $ rm work.txt </code>
slaxemulator@7 99
slaxemulator@7 100 The command //rm// has several options. To delete a directory and its contents, we use the //-rf// option. Example:
slaxemulator@7 101
slaxemulator@7 102 <code> $ rm -rf /home/hacker/Templates </code>
slaxemulator@7 103
slaxemulator@7 104 Note you can also use the //-i// option to remove files or directories and their contents interactively:
slaxemulator@7 105
slaxemulator@7 106 <code> $ rm -ir /home/hacker/Templates </code>
slaxemulator@7 107
slaxemulator@7 108 ===== View files =====
slaxemulator@7 109
slaxemulator@7 110 To read the contents of a file or script, you can use the less, more or cat commands, or the web browser Retawq. Examples with a README file, essential.txt, and script.sh:
slaxemulator@7 111
slaxemulator@7 112 <code>
slaxemulator@7 113 $ less -EM essential.txt
slaxemulator@7 114 or :
slaxemulator@7 115 $ more README
slaxemulator@7 116 or :
slaxemulator@7 117 $ cat /path/to/script.sh
slaxemulator@7 118 </code>
slaxemulator@7 119
slaxemulator@7 120 Display a text or html file with the web browser Retawq:
slaxemulator@7 121
slaxemulator@7 122 <code> $ retawq /usr/share/doc/index.html </code>
slaxemulator@7 123
slaxemulator@7 124 ===== Edit files =====
slaxemulator@7 125
slaxemulator@7 126 Editing text files, scripts, configuration files, etc, can be done easily using the text editor GNU Nano in a console or graphical terminal. Example with a file bookmarks.html (<Ctrl+X> to quit and save):
slaxemulator@7 127
slaxemulator@7 128 <code> $ nano Public/bookmarks.html </code>
slaxemulator@7 129
slaxemulator@7 130 ===== Cat =====
slaxemulator@7 131
slaxemulator@7 132 You can use the //cat// command to create various text files. EOF signifies End Of File, this is where the file ends. Example with a file packages.list, this removes the current contents of the file and lets you add some new text:
slaxemulator@7 133
slaxemulator@7 134 <code>
slaxemulator@7 135 $ cat > packages.list << "EOF"
slaxemulator@7 136 The text...
slaxemulator@7 137 and more text
slaxemulator@7 138
slaxemulator@7 139 EOF
slaxemulator@7 140 </code>
slaxemulator@7 141
slaxemulator@7 142 To append to the following text file, put two greater than signs (>>) after cat, example:
slaxemulator@7 143
slaxemulator@7 144 <code>
slaxemulator@7 145 $ cat >> packages.list << "EOF"
slaxemulator@7 146 The text...
slaxemulator@7 147
slaxemulator@7 148 EOF
slaxemulator@7 149 </code>
slaxemulator@7 150
slaxemulator@7 151 ===== Navigate the web =====
slaxemulator@7 152
slaxemulator@7 153 Surf the web quickly and simply with the 'retawq' text-mode web browser. Note that you can also use the local browser. You can then navigate easily with the arrows on your keyboard - links are colored blue and can be followed by pressing <ENTER>:
slaxemulator@7 154
slaxemulator@7 155 <code>
slaxemulator@7 156 $ retawq http://www.slitaz.org/en
slaxemulator@7 157 or :
slaxemulator@7 158 $ retawq http://localhost/
slaxemulator@7 159 </code>
slaxemulator@7 160
slaxemulator@7 161 ===== Talk on IRC =====
slaxemulator@7 162
Christian@138 163 To discuss and transfer files via the many IRC servers available, SliTaz provides Rhapsody. The IRC client is simple, fast and lightweight, providing a pleasant, easy to handle ncurses configuration menu. This can be installed through tazpkg. To start the application from a terminal connecting to server (//irc.toile-libre.org//) and joining //#slitaz//:
slaxemulator@7 164
slaxemulator@7 165 <code>
slaxemulator@7 166 $ rhapsody
slaxemulator@7 167 /connect irc.freenode.net
slaxemulator@7 168 /join #slitaz
slaxemulator@7 169 </code>
slaxemulator@7 170
slaxemulator@7 171 ===== Download files =====
slaxemulator@7 172
slaxemulator@7 173 To download various file formats on the internet, you have the //wget// command. To grab a simple html page, the contents of a folder or an entire website:
slaxemulator@7 174
slaxemulator@7 175 <code> $ wget http://www.slitaz.org/en/doc/handbook/ </code>
slaxemulator@7 176
slaxemulator@7 177 ===== List the available partitions =====
slaxemulator@7 178
slaxemulator@7 179 To list the partitions on an internal or external hard drive, you can use cat to display the contents of ///proc/partitions// or use the //fdisk// utility with the -l option meaning list. You can then mount the individual partition(s) that you want to use:
slaxemulator@7 180
slaxemulator@7 181 <code>
slaxemulator@7 182 $ cat /proc/partitions
slaxemulator@7 183 or :
slaxemulator@7 184 # fdisk -l
slaxemulator@7 185 </code>
slaxemulator@7 186
slaxemulator@7 187 ===== Mount a partition, CD or USB drive =====
slaxemulator@7 188
slaxemulator@7 189 To mount a local partition in the SliTaz filesystem, we recommend you use the ///mnt// directory. Example creating the necessary directory and mounting the hda6 partition of the first local hard drive on ///mnt/hda6//:
slaxemulator@7 190
slaxemulator@7 191 <code>
slaxemulator@7 192 # mkdir -p /mnt/hda6
slaxemulator@7 193 # mount -t ext3 /dev/hda6 /mnt/hda6
slaxemulator@7 194 </code>
slaxemulator@7 195
slaxemulator@7 196 SliTaz functions in RAM, you can mount the same cdrom or remove it to mount another (/dev/cdrom is a link to the first cdrom drive). Note that a cdrom is a removable medium and should be mounted on ///media//:
slaxemulator@7 197
slaxemulator@7 198 <code> # mount -t iso9660 /dev/cdrom /media/cdrom </code>
slaxemulator@7 199
slaxemulator@7 200 To mount a USB or flash drive you must specify the proper filesystem. Normally a USB key is formatted in FAT32 which can be read from GNU/Linux and Windows operating systems. On a GNU/Linux system is it generally recognized as the sda1 device - we now prepare a link sda1 on flash to facilitate the task. Note it is also a removable medium and should be mounted on ///media//:
slaxemulator@7 201
slaxemulator@7 202 <code> # mount -t vfat /dev/flash /media/flash </code>
slaxemulator@7 203
slaxemulator@7 204 ===== Turn off the system or restart =====
slaxemulator@7 205
slaxemulator@7 206 To stop or restart SliTaz, you can use the halt or reboot commands or the <Ctrl+Alt+Delete> key combination which enables a system reboot. In case of any problems you can use the -f option signifing forced:
slaxemulator@7 207
slaxemulator@7 208 <code>
slaxemulator@7 209 # halt
slaxemulator@7 210 To restart :
slaxemulator@7 211 # reboot
slaxemulator@7 212 Or :
slaxemulator@7 213 # reboot -f
slaxemulator@7 214 </code>