Friday

Some Useful Unix Commands

To Create symbolic Link between files or directories: ---------------------------------------------------------- A symbolic link, also termed a soft link, is a special kind of file that points to another file, much like a shortcut in Windows or a Macintosh alias. Unlike a hard link, a symbolic link does not contain the data in the target file. It simply points to another entry somewhere in the file system. This difference gives symbolic links certain qualities that hard links do not have, such as the ability to link to directories, or to files on remote computers networked through NFS. Also, when you delete a target file, symbolic links to that file become unusable, whereas hard links preserve the contents of the file. To create a symbolic link in Unix, at the Unix prompt, enter the following command: ln -s source_file myfile Replace source_file with the name of the existing file for which you want to create the symbolic link (this file can be any existing file or directory across the file systems). Replace myfile with the name of the symbolic link. The ln command then creates the symbolic link. After you've made the symbolic link, you can perform an operation on or execute myfile, just as you could with the source_file. You can use normal file management commands (e.g., cp, rm) on the symbolic link. Note: If you delete the source file or move it to a different location, your symbolic file will not function properly. You should either delete or move it. If you try to use it for other purposes (e.g., if you try to edit or execute it), the system will send a "file nonexistent" message. To find out more about symbolic links, you can view the man pages for the ln command. To do this, at the Unix prompt, enter the following command: man ln To find the current values of all my environment variables and functions? ----------------------------------------------------------------------------- To find the current values of all your environment variables and functions in Unix, if you are using the sh, ksh, or bash shell, at the prompt, enter: set If you are using the csh or tcsh shell, enter: printenv The resulting lists show all environment variables (e.g., home, shell) and functions, and their values, both default and user-defined. On most systems, entering setenv will display the same results as printenv. For more information about the printenv or set commands, at the Unix prompt, enter either of the following commands: man printenv man set To display information about the operating system: -------------------------------------------------- On most Unix systems, you can use the uname command to determine which Unix system (e.g., SunOS, AIX, IRIX, Linux, Darwin) is running on your computer. On most systems, to obtain additional information about the operating system, at the Unix prompt, enter: uname -a To find out what the uname -a command displays, and what additional options it supports, at the Unix prompt, enter: man uname