How to resume screen?

The wording is a little unlucky – this happens because there still is a screen session attached to 14313.pts-18.b-dev03 and you cannot simply “resume” a non-detached session. You need to use the -x option in addition to attaching to this session with a second screen instance (or, alternatively, detach the existing session first): -x Attach … Read more

How to delete a substring using shell script

Multiple ways, a selection: str=abc.out Shell: echo ${str%.*} Grep: echo $str | grep -o ‘^[^\.]*’ Sed: echo $str | sed -E ‘s/(.*?)\..*/\1/’ Awk: echo $str | awk -F. ‘{print $1}’ -F. means split the string by . and $1 means the first column. Cut: echo $str | cut -d. -f1 All output: abc

Batch convert latin-1 files to utf-8 using iconv

You shouldn’t use ls like that and a for loop is not appropriate either. Also, the destination directory should be outside the source directory. mkdir /path/to/destination find . -type f -exec iconv -f iso-8859-1 -t utf-8 “{}” -o /path/to/destination/”{}” \; No need for a loop. The -type f option includes files and excludes directories. Edit: … Read more