cat abc
will show the contents of the file called abc.
cat -v abc
uses the -v flag (for verbose mode) to also show where the tabs are.
Command | Description |
basename pathname | show the final part (filename or directory) of the pathname. Can take an additional argument, which is a suffix to be stripped. For instance running the command below will print resume:
basename $HOME/resume.doc .doc
Try: dirname /abc/def/123
|
cd directory | change working directory. After the command, type in the new directory you want to go to. It will make that directory your current one. |
cal | show a calendar for the current month. You can also specify a year and see the calendar for the whole year. (i.e. cal 2001) |
cat file_name | print the contents of a file to the screen. It is your responsibility to make sure to only cat a text file. |
chmod | change the mode of a file to allow different permissions. |
cp original_file new_file | copy the original file to a file named new_file. If the new file already exists, it will be overwritten. |
cpio | copy or backup files. Similar to zip. |
date | display the current date and time. You can optionally
specify formatting options. For instance, running the command below on a Sunday
will print out "Today is Sunday."
date '+Today is %A.' |
diff file1 file2 | shows the differences between the two files. |
dirname pathname | show the directory pathname containing the specified pathname; it strips off everything after the last slash.
Try: dirname /abc/def/123
|
echo arguments | print the arguments to the screen. |
exit | log off the system. |
file file_name | display what type of file it is. UNIX does not pay attention to extensions. So, just because a file is named file.txt does not mean that it is a text file. |
find | search for files. |
grep | search files for a particular regular expression (more on that later). |
head | shows the first few lines in a file. |
ls | list the contents of a directory. The -l flag will give you a long listing that includes information about each file. |
man command | print the online manual page for the command. Press space to see the next page. Enter q to quit. |
mkdir directory_name | make a new directory (folder). |
more | show the contents of a file, one page at a time. Press space to see the next page. Enter q to quit. |
mv original_file new_file | move the original file to a file named new_file. If the new file already exists, it will be overwritten. |
od | octal dump. shows the contents of a file as octal characters. Used to examine non-text files. |
passwd | change your password. |
ps | process status. This lists information about running processes. |
pwd | print working directory. It will tell you what directory (folder) you are in. |
rm file_name | remove the file. There is no undo, so be careful! |
rmdir directory_name | remove the directory. The directory must be empty. |
sort | sorts its input alphabetically. |
stty | set terminal options. |
tar | copy or backup files (stands for tape archive). Similar to zip. |
tail | shows the last few lines in a file. |
wc | word count. Counts characters, words, and lines in a file. |
who | display all the users currently logged into the machine. |