
Using Linux the CLI way - Cheat Sheet 1. Basic Operations cp /path_to_copy_form /path_to_copy_to page a time. The | is the pipe symbol (on many Copy files from source to destination. keyboards it is a shift \ ). The pipe makes the output Linux, like any other Unix system is case sensitive so stop after each screen. For long files, it is sometimes type them exactly as they are written in this article. mv source destination convenient to use the commands head and tail that Move or rename files. The same command is used for display just the beginning and the end of the file. If you The File Separator moving and renaming files and directories. happened to use cat on a binary file and your terminal An important feature that differentiates Unix systems displays funny characters afterwards, you can restore it from Windows systems is the way one refers to the File ln source destination with the command reset. Separator. On UNIX based systems it’s as follows. Create a hard link called destination to the file called source. The link appears as a copy of the original files, less filename /usr/local/apache/httpd.conf but in reality only one copy of the file is kept, just two Scroll through the contents of a text file. Press q when -----> the forward file separator. (or more) directory entries point to it. Any changes in done. Less is roughly equivalent to more, the command the file are automatically visible throughout. When one you just read about. While on Windows systems. directory entry is removed, the others stay intact. The C:\webserver\apache\httpd.conf -----> the backward file limitation of the hard links is that the files have to be on pico filename separator. the same file system. Hard links to directories or special Edit a text file using the simple and standard text editor files are impossible. called pico. (comes with the pine mail program) any_command --help | more Display a brief help file on a command (works with most ln -s source destination pico -w filename commands). –help works similar to DOS /h switch. The Create a symbolic (soft) link called destination to the file Edit a text file, while disabling the long line wrap. Handy more pipe is needed if the output is longer than one called source. The symbolic link just specifies a path for editing configuration files. e.g. /etc/fstab. We advise screen. where to look for the file. In contradistinction to hard you to disable the word wrap feature for the simple links, the source and destination do not have to be on reason that you can easily mess up the configuration | the same file system. Compared with hard links, the files with Word Wrap on, because the line length will This isn’t an L, it is what we call the redirection drawback of symbolic links is that if the original file is differ from system to system. operator. If you are trying to find it on your keyboard, removed, the link is broken. Symbolic links can also you’ll probably see it on the top row with the numerical create circular references (like circular references in lynx file.html keys. The main purpose of the redirector is to redirect spreadsheets or databases, ( e.g., a points to b and b View an html file or browse the net from text mode. output from one process to another. It works at the shell points back to a). level and is very handy to have around. More on this tar -xvzf filename.tar.gz later. rm files Untar a tarred and compressed tarball (*.tar.gz or *.tgz) Remove (delete) files. You must own the file in order to that you downloaded from the Internet. ls be able to remove it. Lists the content of the current directory. Under Linux, tar -xvf filename.tar the command dir is an alias to ls. Many users have ls to mkdir directory Untar a tarred but uncompressed tarball (*.tar). be an alias to ls --color. Make a new directory. gunzip filename.gz ls -al | more rmdir directory Decompress a zipped file (*.gz or *.z). Use gzip (also List the content of the current directory, all files (also Remove an empty directory. zip or compress) if you want to compress files. those starting with a dot), and in a long form. Pipe the output through the more command, so that the display rm -r files bunzip2 filename.bz2 pauses after each screen fill. (Recursive remove) Remove files, directories, and their Decompress a file (*.bz2) zipped with bzip2 subdirectories. compression utility. Used for big files. cd /path_to_directory Be careful with this command when logged in as root-- Change directory. cd - will take you to your previous you can easily remove all files on the system if you are unzip filename.zip directory and is a convenient way to toggle between not careful. Decompress a file (*.zip) zipped with a compression two directories. utility compatible with PKZIP for DOS. cat filename | more View the contents of a text file called filename, one Pg. 1 Using Linux the CLI way - Cheat Sheet default is opened on display 0). You can have several find / -name filename rsh server (remote shell) GUI terminals running concurrently. Switch between Find the file called filename on your file system starting Yet another way to connect to a remote machine. The them using Ctrl+Alt+F7, Ctrl+Alt+F8, etc. the search from the root directory / . The filename may login name/password from your current session is used; contain wildcards (*,?). if it fails you are prompted for a password. xterm (an X terminal) Run a simple X-windows terminal. Typing exit will close locate filename ftp server it. Find the file name of which contains the string filename. Ftp to another machine. (There is also ncftp which adds Easier and faster than the previous command but extra features and gftp for GUI). Ftp is good for copying shutdown -h depends on a database that normally rebuilds at night. files to/from a remote machine. Try user anonymous if Shut down the system to a halt. Allowed only when you don’t have an account on the remote server. logged in as root. From the console you may use pine Ctrl+Alt+Del to issue a shutdown -r now. This can be A good text-mode mail reader. Pine will let you read The essential ftp commands are: done by any user. your local mail, e.g. the mail you get from a computer ls - list the files on the remote system on your home network. ASCII - set the file transfer mode to text mode halt binary set the file transfer mode to binary mode Halt the machine, simpler to type than the previous talk username1 get - copy a file from the remote system to the local command. Talk to another user currently logged on your machine system (or use talk username1@machinename to talk to a mget - get many files at once - (use *.*) man topic user on a different computer). To accept the invitation put - copy a file from the local system to the remote Display the contents of the system manual pages (help) to the conversation, type the command talk system on the topic. Try man man first. Press q to quit the username2. If somebody is trying to talk to you and it mput - put many files at once viewer. The command info works in a similar fashion disrupts your work, your may use the command mesg n bye - disconnect and may contain more up-to-date information. Manual to refuse accepting messages. You may want to use pages can sometimes be hard to read. who or rwho to determine the users who are currently For automation in a script, you may want to use logged-in. ncftpput and ncftpget, for example: --help ncftpput -u my_user_name -p my_password -a Brings up a short, easy to digest help on a command. If mc remote.host.domain remote_dir *local.html you need more info, go to the directory /usr/doc and Launch the Midnight Commander file manager (looks look for the command. like Norton Commander) for Linux. minicom Minicom program. It’s a communication program that telnet server somewhat resembles the famous old DOS 2. System Information Connect to another machine using the TELNET communication program, Telix. You could always use protocol. Use a remote machine name or IP address. your existing shell accounts via minicom. who You will be prompted for your login name and List the users logged in on the machine. -- password--you must have an account on the remote /program_name machine to login. Telnet will connect you to another Run an executable in the current directory, which is not rwho -a machine and let you operate on it as if you were sitting on your PATH List all users logged in on your network. The rwho at its keyboard (almost). Telnet is not very secure-- service must be enabled for this command to work. everything you type goes in open text, even your xinit password!. Start a barebone X-windows server (without a window finger user_name manager). System info about a user. Try: finger root last. This rlogin server lists the users last logged-in on your system. (Rremote login) Connect to another machine. The login startx name/password from your current session is used; if it Start an X-windows server and the default window history | more fails you are prompted for a password. (Not very manager. Works like typing win under DOS with Win3.1 Show the last (1000 or so) commands executed from secure!) the command line on the current account.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages6 Page
-
File Size-