Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
labs:unix_intermediate [2009/06/12 15:52] – admin | labs:unix_intermediate [2024/09/05 17:21] (current) – [Intermediate Unix Commands] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Intermediate Unix Commands ====== | ||
+ | This page contains just a teaser of some helpful commands. | ||
+ | ===== Permissions ===== | ||
+ | |||
+ | UNIX organizes permissions by user, group, and others. | ||
+ | |||
+ | '' | ||
+ | |||
+ | ==== Groups ==== | ||
+ | |||
+ | To change the group associated with a file, use '' | ||
+ | |||
+ | |||
+ | ===== Finding Content: grep ===== | ||
+ | |||
+ | Gnu Regular Expression Print ('' | ||
+ | |||
+ | Example: I want to find all the names that start with " | ||
+ | |||
+ | grep Sara names.txt | ||
+ | ===== Finding Files: find ===== | ||
+ | |||
+ | You can find files with various characteristics using the '' | ||
+ | |||
+ | Examples: | ||
+ | |||
+ | Find all of the files with the .txt extension in the current directory and its subdirectories | ||
+ | |||
+ | find . -name " | ||
+ | | ||
+ | Find all of the files in my home directory (and its subdirectories) that have no data in them (have 0 Bytes of data) | ||
+ | |||
+ | find ~ -size 0 | ||
+ | | ||
+ | View all of the information (e.g., last modified date) of all of the files in my home directory (and its subdirectories) that have no data in them | ||
+ | |||
+ | find ~ -size 0 -exec ls -l {} \; | ||
+ | ===== Finding Differences Between Files: diff ===== | ||
+ | |||
+ | ===== Beginning of Files: head ===== | ||
+ | |||
+ | Usage: | ||
+ | |||
+ | head < | ||
+ | |||
+ | shows the first few lines of a file. You can use a flag to change how many lines are displayed | ||
+ | ===== End of Files: tail ===== | ||
+ | |||
+ | ===== Viewing Services Listening on a Port ===== | ||
+ | |||
+ | lsof -i :< | ||
+ | |||
+ | e.g., | ||
+ | |||
+ | lsof -i :8080 |