1+ tag : learn-linux-shell-iterm2
2+ name : Learn Linux shell - iterm2
3+ description : |
4+ Cortex Learn series: Learn how to install and use iterm2 terminal program. Author: [email protected] . 5+ draft : false
6+ notifications :
7+ enabled : false
8+ scoreDropNotificationsEnabled : false
9+ exemptions :
10+ enabled : false
11+ autoApprove : false
12+ evaluation :
13+ window : 168
14+ ladder :
15+ name : Default Ladder
16+ levels :
17+ - name : Incomplete
18+ rank : 1
19+ color : " #FF9E9E"
20+ - name : Completed
21+ rank : 2
22+ color : " #7CCB92"
23+ rules :
24+ - title : Learned
25+ expression : " customEvents(lookback = duration(\" P10Y\" ), types = [\" LEARN_CORTEX\" \
26+ ]).filter((event) => event.title == \" Learn Linux shell - iterm2\" ).length > 0"
27+ identifier : 921bc595-5a12-3aa1-af45-e17d17e0d649
28+ weight : 1
29+ level : Completed
30+ failureMessage : " # About\n In this Learn Cortex scorecard you will:\n - install [iterm2](https://iterm2.com/),\
31+ \ an alternate MacOS terminal program\n - add the CORTEX_API_KEY environment variable\
32+ \ to your .bashrc file\n\n # Set up\n - [Download](https://iterm2.com/downloads/stable/latest)\
33+ \ and install [iterm2](https://iterm2.com).\n - After installing, click on the\
34+ \ iterm2 icon to launch the terminal.\n\n ## Change the default SHELL to bash\n \
35+ From [LinuxCommand.org](https://linuxcommand.org), the shell is a program that\
36+ \ takes commands from the keyboard and gives them to the operating system to perform.\n \
37+ \n The default shell on MacOS is zsh. We are going to change it to bash because\
38+ \ I'm most familiar with bash.\n\n - Type \n ```\n echo $SHELL\n ```\n \
39+ \ and press return to see the name of the default shell.\n ```\n jeffschnitter@mac\
40+ \ ~ $ echo $SHELL\n /bin/zsh\n ```\n - Type \n ```\n chsh -s /bin/bash\n \
41+ \ ```\n to change the default shell to bash.\n\n You will be prompted\
42+ \ to enter your Mac login password.\n\n ```\n jeffschnitter@mac ~ $ chsh\
43+ \ -s /bin/bash\n Changing shell for jeffschnitter.\n Password for jeffschnitter:\n \
44+ \ jeffschnitter@mac ~ $\n ```\n - Close iterm2 and reopen it.\n - Type `echo\
45+ \ $SHELL` and press return to see the name of the default shell. It should be\
46+ \ changed to /bin/bash.\n ```\n jeffschnitter@mac ~ $ echo $SHELL\n /bin/bash\n \
47+ \ ```\n\n ## Add your CORTEX_API_KEY variable to your .bashrc file\n\n - When\
48+ \ your shell program is /bin/bash, any time you start a terminal window, a file\
49+ \ in your home directory named .bashrc will get sourced, meaning all the shell\
50+ \ commands in that file will get executed.\n\n - Your home directory is defined\
51+ \ with an environment variable named $HOME. A shorthand way to refer to your\
52+ \ home directory is to use the ~ character.\n ```\n jeffschnitter@mac ~\
53+ \ $ echo $HOME\n /Users/jeffschnitter\n jeffschnitter@mac ~ $ echo ~\n \
54+ \ /Users/jeffschnitter\n ```\n\n - Therefore, we can refer to your .bashrc\
55+ \ file in your home directory with both of these forms:\n - $HOME/.bashrc\n \
56+ \ - ~/.bashrc\n\n - If you have not previously created a personal token, follow\
57+ \ the directions at https://docs.cortex.io/settings/api-keys/personal-tokens#creating-a-personal-token.\
58+ \ Save the contents of the key in your clipboard.\n\n - Paste the following contents\
59+ \ (replace _yourApiKey_ with the contents of your personal token or API key) into\
60+ \ your terminal and press enter.\n ````\n cat << EOF >> ~/.bashrc\n export\
61+ \ CORTEX_API_KEY=_your API key_\n EOF\n ```\n - ~/.bashrc is sourced when\
62+ \ you open a new terminal. Alternatively you can type \n ```\n source ~/.bashrc\n \
63+ \ ```\n to source the command. Do one of these things to have the contents\
64+ \ of your ~/.bashrc file re-evaluated.\n\n - Enter \n ```\n echo $CORTEX_API_KEY\n \
65+ \ ```\n\n - You should see the contents of your API key on the terminal.\n \
66+ \ ```\n jeffschnitter@mac ~ $ echo $CORTEX_API_KEY\n eyJhbGciOifYouCanReadThisYouAreTooCloseiJIUzUxMiIs\n \
67+ \ jeffschnitter@mac ~ $\n ```\n\n\n ## Further reading\n - [LinuxCommand.org](https://linuxcommand.org/)\n \
68+ \n # Related Cortex Academy courses\n None.\n\n # Task\n Paste the contents below\
69+ \ into your shell and press enter. This will use the value of your CORTEX_API_KEY\
70+ \ environment variable set in your ~/.bashrc file to authenticate with the Cortex\
71+ \ API and create a custom event for the Learn Cortex entity.\n \n ```\n curl -X\
72+ \ POST \" https://api.getcortexapp.com/api/v1/catalog/learn-cortex/custom-events\" \
73+ \ \\\n -H \" Content-Type: application/json\" \\\n -H \" Authorization: Bearer\
74+ \ ${CORTEX_API_KEY}\" \\\n --data-binary @- <<EOF\n {\n \" customData\" \
75+ : {\n },\n \" description\" : \" Custom event created from a terminal\
76+ \ curl command\" ,\n \" timestamp\" : \" $(date +'%Y-%m-%dT%H:%M:%S.%3Z')\" \
77+ ,\n \" title\" : \" Learn Linux Shell - iterm2\" ,\n \" type\" : \" LEARN_CORTEX\" \
78+ \n }\n EOF\n ```\n\n\n # CQL Rule\n The CQL checks to see if you have a Custom\
79+ \ Event of type 'LEARN_CORTEX' with a title of \" Learn Linux Shell - iterm2\" \
80+ . You need to recreate this event every 10 years or else this rule will fail.\
81+ \ :)\n "
82+ filter :
83+ kind : GENERIC
84+ groups :
85+ include :
86+ - learn-cortex
0 commit comments