What does this means if [ $# -ne 3 ] in Linux / Unix?
- How do I Grep (unix, Linux) to match either of two strings?
- Linux / Unix: sed – How to replace text in multiple files?
- Textpad – Best Text Editor For Regex Operations.
- Linux / Unix / Bash Help: A check to see if a wildcard expression of files/folders exists or not
- Paymentech file comparison in Linux
What does this means if [ $# -ne 3 ] in Linux / Unix?
If the number of arguments is not equal to 3 … do something.
$# # Number of arguments.
what does head – 20 in unix means?
It means extract or show top 20 lines
what does tail – 20 in unix means?
It means extract or show bottom 20 lines
QUICK REFERENCE
* Useful commands:
cat # Lists a file or files sequentially.
cd # Change directories.
chmod +x # Set execute permissions.
chmod 666 # Set universal read-write permissions.
cp # Copy files.
expr 2 + 2 # Add 2 + 2.
fgrep # Search for string match.
grep # Search for string pattern matches.
grep -v # Search for no match.
grep -n # List line numbers of matches.
grep -i # Ignore case.
grep -l # Only list file names for a match.
head -5 source.txt # List first 5 lines.
ll # Give a listing of files with file details.
ls # Give a simple listing of files.
mkdir # Make a directory.
more # Displays a file a screenfull at a time.
mv # Move or rename files.
paste f1 f2 # Paste files by columns.
pg # Variant on “more”.
pwd # Print working directory.
rm # Remove files.
rm -r # Remove entire directory subtree.
rmdir # Remove a directory.
sed ’s/txt/TXT/g’ # Scan and replace text.
sed ’s/txt/d’ # Scan and delete text.
sed ‘/txt/q’ # Scan and then quit.
sort # Sort input.
sort +1 # Skip first field in sorting.
sort -n # Sort numbers.
sort -r # Sort in reverse order.
sort -u # Eliminate redundant lines in output.
tail -5 source.txt # List last 5 lines.
tail +5 source.txt # List all lines after line 5.
tr ‘[A-Z]‘ ‘[a-z]‘ # Translate to lowercase.
tr ‘[a-z]‘ ‘[A-Z]‘ # Translate to uppercase.
tr -d ‘_’ # Delete underscores.
uniq # Find unique lines.
wc # Word count (characters, words, lines).
wc -w # Word count only.
wc -l # Line count.

Comments
No comments yet.